Simplify about string logic
This commit is contained in:
parent
25d206e4f7
commit
c1b5811c39
3 changed files with 3 additions and 93 deletions
|
@ -1,20 +1,12 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LocalizerType } from '../types/Util';
|
||||
import type { ConversationAttributesType } from '../model-types';
|
||||
|
||||
export function sanitizeAboutText(
|
||||
text: string | undefined
|
||||
): string | undefined {
|
||||
return text?.replace(/[✓✔☑√⛉⛊⛛]/g, '');
|
||||
}
|
||||
|
||||
export function getAboutText(
|
||||
attributes: Pick<ConversationAttributesType, 'about' | 'aboutEmoji'>,
|
||||
i18n: LocalizerType = window.i18n
|
||||
attributes: Pick<ConversationAttributesType, 'about' | 'aboutEmoji'>
|
||||
): string | undefined {
|
||||
const text = sanitizeAboutText(attributes.about);
|
||||
const text = attributes.about;
|
||||
|
||||
if (!text) {
|
||||
return undefined;
|
||||
|
@ -26,7 +18,7 @@ export function getAboutText(
|
|||
return text;
|
||||
}
|
||||
|
||||
return i18n('icu:message--getNotificationText--text-with-emoji', {
|
||||
return window.i18n('icu:message--getNotificationText--text-with-emoji', {
|
||||
text,
|
||||
emoji,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue