Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the "MERGED_" prefix correctly #42260

Merged
merged 4 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const onboardingChoices = {
type OnboardingPurposeType = ValueOf<typeof onboardingChoices>;

const CONST = {
MERGED_ACCOUNT_PREFIX: 'MERGED_',
DEFAULT_POLICY_ROOM_CHAT_TYPES: [chatTypes.POLICY_ADMINS, chatTypes.POLICY_ANNOUNCE, chatTypes.DOMAIN_ALL],

// Note: Group and Self-DM excluded as these are not tied to a Workspace
Expand Down
4 changes: 2 additions & 2 deletions src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function getDisplayNameOrDefault(passedPersonalDetails?: Partial<PersonalDetails
let displayName = passedPersonalDetails?.displayName ?? '';

// If the displayName starts with the merged account prefix, remove it.
if (displayName.startsWith(CONST.MERGED_ACCOUNT_PREFIX)) {
if (new RegExp(CONST.REGEX.MERGED_ACCOUNT_PREFIX).test(displayName)) {
// Remove the merged account prefix from the displayName.
displayName = displayName.substring(CONST.MERGED_ACCOUNT_PREFIX.length);
displayName = displayName.replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '');
}

// If the displayName is not set by the user, the backend sets the diplayName same as the login so
Expand Down
Loading