diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-07 11:09:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 11:09:25 -0500 |
commit | ab11f206d8a14443d68408f237fd99dd33752185 (patch) | |
tree | f132c1bbd1ff540f2fac6b53398c6128a63468d0 /src/lib | |
parent | 4b9899225790b76b8ff525bf8fffc8cc0c831af7 (diff) | |
download | voidsky-ab11f206d8a14443d68408f237fd99dd33752185.tar.zst |
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/notifee.ts | 5 | ||||
-rw-r--r-- | src/lib/strings/display-names.ts | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/notifee.ts b/src/lib/notifee.ts index d2e29c0a7..866319031 100644 --- a/src/lib/notifee.ts +++ b/src/lib/notifee.ts @@ -3,6 +3,7 @@ import {AppBskyEmbedImages} from '@atproto/api' import {RootStoreModel} from 'state/models/root-store' import {NotificationsFeedItemModel} from 'state/models/feeds/notifications' import {enforceLen} from 'lib/strings/helpers' +import {sanitizeDisplayName} from './strings/display-names' import {resetToTab} from '../Navigation' export function init(store: RootStoreModel) { @@ -42,7 +43,9 @@ export function displayNotification( export function displayNotificationFromModel( notif: NotificationsFeedItemModel, ) { - let author = notif.author.displayName || notif.author.handle + let author = sanitizeDisplayName( + notif.author.displayName || notif.author.handle, + ) let title: string let body: string = '' if (notif.isLike) { diff --git a/src/lib/strings/display-names.ts b/src/lib/strings/display-names.ts new file mode 100644 index 000000000..5b58dec3d --- /dev/null +++ b/src/lib/strings/display-names.ts @@ -0,0 +1,12 @@ +// \u2705 = ✅ +// \u2713 = ✓ +// \u2714 = ✔ +// \u2611 = ☑ +const CHECK_MARKS_RE = /[\u2705\u2713\u2714\u2611]/gu + +export function sanitizeDisplayName(str: string): string { + if (typeof str === 'string') { + return str.replace(CHECK_MARKS_RE, '') + } + return '' +} |