Skip to content

Commit

Permalink
fix: show former user if user is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Oct 8, 2024
1 parent 8a1621e commit 6b2dc7d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/community/user/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ import env from '../../../env';
import SC from './styled';

import type { CommunityUser } from '../../../types';
import translations from '../../../lib/localization';

const { FDK_COMMUNITY_BASE_URI } = env;

interface Props {
user: CommunityUser;
}

const Username = ({ user }: { user: CommunityUser }) => {
const name = user.displayname ?? user.username;
return name.includes('former-user')
? translations.community.formerUser
: name;
};

const User: FC<Props> = ({ user }) => (
<SC.User href={`${FDK_COMMUNITY_BASE_URI}/user/${user.userslug}`}>
{user.picture ? (
Expand All @@ -20,7 +28,9 @@ const User: FC<Props> = ({ user }) => (
<SC.Icon colour={user['icon:bgColor']}>{user['icon:text']}</SC.Icon>
)}

<SC.Name>{user.displayname ?? user.username}</SC.Name>
<SC.Name>
<Username user={user} />
</SC.Name>
</SC.User>
);

Expand Down
1 change: 1 addition & 0 deletions src/l10n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@
"seeAllComments": "See all comments",
"seeAllBlogArticles": "Se alle bloggartikler",
"meetingTitle": "Meeting title: ",
"formerUser": "Former user",
"subtitle": {
"link": "our data community",
"showAllMentions": "Show all mentions in Datalandsbyen",
Expand Down
1 change: 1 addition & 0 deletions src/l10n/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@
"seeAllBlogArticles": "Se alle bloggartikler",
"meetingTitle": "Møtetittel: ",
"seeLatestComments": "Siste kommentarer i",
"formerUser": "Tidligere bruker",
"subtitle": {
"link": "Datalandsbyen",
"mention": " innlegg i ",
Expand Down
1 change: 1 addition & 0 deletions src/l10n/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,7 @@
"seeAllPosts": "Sjå alle saker",
"seeAllBlogArticles": "Sjå alle bloggartiklar",
"meetingTitle": "Møtetittel: ",
"formerUser": "Tidlegare brukar",
"subtitle": {
"link": "Datalandsbyen",
"mention": " innlegg i ",
Expand Down

0 comments on commit 6b2dc7d

Please sign in to comment.