Simplify about string logic

This commit is contained in:
trevor-signal 2024-10-07 23:15:50 -04:00 committed by GitHub
parent 25d206e4f7
commit c1b5811c39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 93 deletions

View file

@ -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,
});