parent
4b98992257
commit
ab11f206d8
12 changed files with 58 additions and 23 deletions
|
@ -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) {
|
||||
|
|
12
src/lib/strings/display-names.ts
Normal file
12
src/lib/strings/display-names.ts
Normal file
|
@ -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 ''
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue