Unify the display name fallback behavior

This commit is contained in:
Paul Frazee 2023-05-17 14:38:23 -05:00
parent 4e56d24a9d
commit 9c02fbb925
3 changed files with 16 additions and 11 deletions

View file

@ -1,6 +1,7 @@
import {AppBskyFeedDefs, AtUri} from '@atproto/api'
import {makeAutoObservable} from 'mobx'
import {RootStoreModel} from 'state/models/root-store'
import {sanitizeDisplayName} from 'lib/strings/display-names'
export class CustomFeedModel {
// data
@ -34,6 +35,13 @@ export class CustomFeedModel {
return this.data.uri
}
get displayName() {
if (this.data.displayName) {
return sanitizeDisplayName(this.data.displayName)
}
return `Feed by @${this.data.creator.handle}`
}
get isSaved() {
return this.data.viewer?.saved
}