From d34eab413f3be03ceb6ac7843b7c3c363562b282 Mon Sep 17 00:00:00 2001 From: mkleszcz Date: Tue, 30 Jul 2024 10:52:58 +0200 Subject: [PATCH] fix: #601 Fix copy inconsistency (#609) --- packages/backend/apps/users/models.py | 3 ++- .../tenantInvitationForm.component.tsx | 2 +- .../tenantMembers/tenantMembers.component.tsx | 2 +- packages/workers/userauth/models.py | 7 +++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/backend/apps/users/models.py b/packages/backend/apps/users/models.py index ee075e093..92d56825d 100644 --- a/packages/backend/apps/users/models.py +++ b/packages/backend/apps/users/models.py @@ -101,4 +101,5 @@ class UserProfile(models.Model): ) def __str__(self) -> str: - return f"{self.first_name} {self.last_name}" + full_name = f"{self.first_name} {self.last_name}".strip() + return full_name if full_name else self.user.email diff --git a/packages/webapp-libs/webapp-tenants/src/components/tenantInvitationForm/tenantInvitationForm.component.tsx b/packages/webapp-libs/webapp-tenants/src/components/tenantInvitationForm/tenantInvitationForm.component.tsx index 9bdd761fd..e1d056ba3 100644 --- a/packages/webapp-libs/webapp-tenants/src/components/tenantInvitationForm/tenantInvitationForm.component.tsx +++ b/packages/webapp-libs/webapp-tenants/src/components/tenantInvitationForm/tenantInvitationForm.component.tsx @@ -84,7 +84,7 @@ export const TenantInvitationForm = ({ initialData, onSubmit, error, loading }: id: 'Tenant invitation form / Email label', })} placeholder={intl.formatMessage({ - defaultMessage: 'Name', + defaultMessage: 'Email', id: 'Tenant invitation form / Email placeholder', })} error={errors.email?.message} diff --git a/packages/webapp-libs/webapp-tenants/src/routes/tenantSettings/tenantMembers/tenantMembers.component.tsx b/packages/webapp-libs/webapp-tenants/src/routes/tenantSettings/tenantMembers/tenantMembers.component.tsx index 8ce3aa955..124beed5a 100644 --- a/packages/webapp-libs/webapp-tenants/src/routes/tenantSettings/tenantMembers/tenantMembers.component.tsx +++ b/packages/webapp-libs/webapp-tenants/src/routes/tenantSettings/tenantMembers/tenantMembers.component.tsx @@ -45,7 +45,7 @@ export const TenantMembers = () => { ) : ( diff --git a/packages/workers/userauth/models.py b/packages/workers/userauth/models.py index abc351e69..48c82b76e 100644 --- a/packages/workers/userauth/models.py +++ b/packages/workers/userauth/models.py @@ -23,6 +23,9 @@ class User(models.Base): cruddemoitem_set: Mapped[List["CrudDemoItem"]] = relationship(back_populates="created_by") documents: Mapped[List["DocumentDemoItem"]] = relationship(back_populates="created_by") + def __str__(self): + return self.email + class UserProfile(models.Base): __tablename__ = "users_userprofile" @@ -34,3 +37,7 @@ class UserProfile(models.Base): first_name = Column("first_name", String) last_name = Column("last_name", String) + + def __str__(self): + full_name = f"{self.first_name} {self.last_name}".strip() + return full_name if full_name else self.user.email