Skip to content

Commit

Permalink
[🐴] show deleted account for missing.invalid (#4014)
Browse files Browse the repository at this point in the history
* show deleted account for `missing.invalid`

* sigh
  • Loading branch information
haileyok authored May 14, 2024
1 parent 08836ec commit e1ed4a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
15 changes: 11 additions & 4 deletions src/screens/Messages/Conversation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ let Header = ({
const navigation = useNavigation<NavigationProp>()
const convoState = useConvo()

const isDeletedAccount = profile?.handle === 'missing.invalid'
const displayName = isDeletedAccount
? 'Deleted Account'
: profile?.displayName

const onPressBack = useCallback(() => {
if (isWeb) {
navigation.replace('Messages')
Expand Down Expand Up @@ -197,11 +202,13 @@ let Header = ({
<Text
style={[a.text_lg, a.font_bold, a.pt_sm, a.pb_2xs]}
numberOfLines={1}>
{profile.displayName}
</Text>
<Text style={[t.atoms.text_contrast_medium]} numberOfLines={1}>
@{profile.handle}
{displayName}
</Text>
{!isDeletedAccount && (
<Text style={[t.atoms.text_contrast_medium]} numberOfLines={1}>
@{profile.handle}
</Text>
)}
</View>
) : (
<>
Expand Down
25 changes: 15 additions & 10 deletions src/screens/Messages/List/ChatListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export function ChatListItem({
const {currentAccount} = useSession()
const menuControl = useMenuControl()
const {gtMobile} = useBreakpoints()
const otherUser = convo.members.find(
member => member.did !== currentAccount?.did,
)
const isDeletedAccount = otherUser?.handle === 'missing.invalid'
const displayName = isDeletedAccount
? 'Deleted Account'
: otherUser?.displayName || otherUser?.handle

let lastMessage = _(msg`No messages yet`)
let lastMessageSentAt: string | null = null
Expand All @@ -44,10 +51,6 @@ export function ChatListItem({
lastMessage = _(msg`Message deleted`)
}

const otherUser = convo.members.find(
member => member.did !== currentAccount?.did,
)

const navigation = useNavigation<NavigationProp>()
const [showActions, setShowActions] = React.useState(false)

Expand Down Expand Up @@ -113,7 +116,7 @@ export function ChatListItem({
numberOfLines={1}
style={[{maxWidth: '85%'}, web([a.leading_normal])]}>
<Text style={[a.text_md, t.atoms.text, a.font_bold]}>
{otherUser.displayName || otherUser.handle}
{displayName}
</Text>
</Text>
{lastMessageSentAt && (
Expand Down Expand Up @@ -147,11 +150,13 @@ export function ChatListItem({
</Text>
)}
</View>
<Text
numberOfLines={1}
style={[a.text_sm, t.atoms.text_contrast_medium, a.pb_xs]}>
@{otherUser.handle}
</Text>
{!isDeletedAccount && (
<Text
numberOfLines={1}
style={[a.text_sm, t.atoms.text_contrast_medium, a.pb_xs]}>
@{otherUser.handle}
</Text>
)}
<Text
numberOfLines={2}
style={[
Expand Down

0 comments on commit e1ed4a4

Please sign in to comment.