diff --git a/src/state/models/feeds/custom-feed.ts b/src/state/models/feeds/custom-feed.ts index 20eef49a..e60ac274 100644 --- a/src/state/models/feeds/custom-feed.ts +++ b/src/state/models/feeds/custom-feed.ts @@ -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 } diff --git a/src/state/models/ui/saved-feeds.ts b/src/state/models/ui/saved-feeds.ts index ce0de25e..85e77cae 100644 --- a/src/state/models/ui/saved-feeds.ts +++ b/src/state/models/ui/saved-feeds.ts @@ -66,15 +66,11 @@ export class SavedFeedsModel { } get listOfFeedNames() { - return this.feeds.map( - f => f.data.displayName ?? f.data.creator.displayName + "'s feed", - ) + return this.feeds.map(f => f.displayName) } get listOfPinnedFeedNames() { - return this.pinned.map( - f => f.data.displayName ?? f.data.creator.displayName + "'s feed", - ) + return this.pinned.map(f => f.displayName) } get savedFeedsWithoutPinned() { diff --git a/src/view/com/feeds/CustomFeed.tsx b/src/view/com/feeds/CustomFeed.tsx index e4e0d50c..95726be6 100644 --- a/src/view/com/feeds/CustomFeed.tsx +++ b/src/view/com/feeds/CustomFeed.tsx @@ -54,9 +54,7 @@ export const CustomFeed = observer( navigation.navigate('CustomFeed', { name: item.data.creator.did, rkey: new AtUri(item.data.uri).rkey, - displayName: - item.data.displayName ?? - `${item.data.creator.displayName}'s feed`, + displayName: item.displayName, }) }} key={item.data.uri}> @@ -65,8 +63,11 @@ export const CustomFeed = observer( - - {item.data.displayName ?? 'Feed name'} + + {item.displayName} + + + by @{item.data.creator.handle} {showSaveBtn && (