Skip to content

Commit

Permalink
Fix empty quotes in title on image-only post
Browse files Browse the repository at this point in the history
  • Loading branch information
KevSlashNull committed May 18, 2024
1 parent d2c81c9 commit 6a0822a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/view/com/post-thread/PostThread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,18 @@ export function PostThread({
)
const [maxReplies, setMaxReplies] = React.useState(50)

useSetTitle(
rootPost && !isNoPwi
? `${sanitizeDisplayName(
rootPost.author.displayName || `@${rootPost.author.handle}`,
)}: "${rootPostRecord!.text}"`
: '',
)
let title = ''
if (rootPost && !isNoPwi) {
const name = sanitizeDisplayName(
rootPost.author.displayName || `@${rootPost.author.handle}`,
)
if (rootPostRecord!.text?.length > 0) {
title = `${name}: "${rootPostRecord!.text}"`
} else {
title = _(msg`Post by ${name}`)
}
}
useSetTitle(title)

// On native, this is going to start out `true`. We'll toggle it to `false` after the initial render if flushed.
// This ensures that the first render contains no parents--even if they are already available in the cache.
Expand Down

0 comments on commit 6a0822a

Please sign in to comment.