[🐴] show deleted account for `missing.invalid` (#4014)

* show deleted account for `missing.invalid`

* sigh
zio/stable
Hailey 2024-05-14 11:42:54 -07:00 committed by GitHub
parent 08836ecbec
commit e1ed4a4429
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 14 deletions

View File

@ -147,6 +147,11 @@ let Header = ({
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const convoState = useConvo() const convoState = useConvo()
const isDeletedAccount = profile?.handle === 'missing.invalid'
const displayName = isDeletedAccount
? 'Deleted Account'
: profile?.displayName
const onPressBack = useCallback(() => { const onPressBack = useCallback(() => {
if (isWeb) { if (isWeb) {
navigation.replace('Messages') navigation.replace('Messages')
@ -197,11 +202,13 @@ let Header = ({
<Text <Text
style={[a.text_lg, a.font_bold, a.pt_sm, a.pb_2xs]} style={[a.text_lg, a.font_bold, a.pt_sm, a.pb_2xs]}
numberOfLines={1}> numberOfLines={1}>
{profile.displayName} {displayName}
</Text>
<Text style={[t.atoms.text_contrast_medium]} numberOfLines={1}>
@{profile.handle}
</Text> </Text>
{!isDeletedAccount && (
<Text style={[t.atoms.text_contrast_medium]} numberOfLines={1}>
@{profile.handle}
</Text>
)}
</View> </View>
) : ( ) : (
<> <>

View File

@ -29,6 +29,13 @@ export function ChatListItem({
const {currentAccount} = useSession() const {currentAccount} = useSession()
const menuControl = useMenuControl() const menuControl = useMenuControl()
const {gtMobile} = useBreakpoints() 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 lastMessage = _(msg`No messages yet`)
let lastMessageSentAt: string | null = null let lastMessageSentAt: string | null = null
@ -44,10 +51,6 @@ export function ChatListItem({
lastMessage = _(msg`Message deleted`) lastMessage = _(msg`Message deleted`)
} }
const otherUser = convo.members.find(
member => member.did !== currentAccount?.did,
)
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const [showActions, setShowActions] = React.useState(false) const [showActions, setShowActions] = React.useState(false)
@ -113,7 +116,7 @@ export function ChatListItem({
numberOfLines={1} numberOfLines={1}
style={[{maxWidth: '85%'}, web([a.leading_normal])]}> style={[{maxWidth: '85%'}, web([a.leading_normal])]}>
<Text style={[a.text_md, t.atoms.text, a.font_bold]}> <Text style={[a.text_md, t.atoms.text, a.font_bold]}>
{otherUser.displayName || otherUser.handle} {displayName}
</Text> </Text>
</Text> </Text>
{lastMessageSentAt && ( {lastMessageSentAt && (
@ -147,11 +150,13 @@ export function ChatListItem({
</Text> </Text>
)} )}
</View> </View>
<Text {!isDeletedAccount && (
numberOfLines={1} <Text
style={[a.text_sm, t.atoms.text_contrast_medium, a.pb_xs]}> numberOfLines={1}
@{otherUser.handle} style={[a.text_sm, t.atoms.text_contrast_medium, a.pb_xs]}>
</Text> @{otherUser.handle}
</Text>
)}
<Text <Text
numberOfLines={2} numberOfLines={2}
style={[ style={[