[Chat] Fix footer logic (#10785)

This commit is contained in:
Samuel Newman
2026-06-08 19:20:37 +03:00
committed by GitHub
parent 5c0429a3f7
commit d9345cb1cf
2 changed files with 26 additions and 2 deletions
@@ -709,7 +709,13 @@ function getFooterState(
convoState: ActiveConvoStates,
hasAcceptOverride?: boolean,
): FooterState {
if (convoState.convo.view.status === 'request' && !hasAcceptOverride) {
const isRequest =
convoState.convo.view.status === 'request' && !hasAcceptOverride
// For group chats, the request footer is driven purely off status: the owner
// is always 'accepted' so never sees it, while members the owner added are
// 'request' until they accept. This holds even before any messages load.
if (convoState.convo.kind === 'group' && isRequest) {
return 'request'
}
@@ -721,6 +727,15 @@ function getFooterState(
}
}
// For direct chats, only show the request footer once there's a message. The
// viewer's status stays 'request' until they send their first message, so an
// empty direct request is one the viewer started themselves (show the
// composer), whereas any message present must be an incoming one from the
// other user (show the accept/reject footer).
if (isRequest) {
return 'request'
}
return 'standard'
}
@@ -738,7 +738,16 @@ function calculateCount(
moderateProfile(convo.primaryMember, moderationOpts).blocked ||
convo.primaryMember.handle === 'missing.invalid' ||
(convo.kind === 'group' && convo.details.lockStatus !== 'unlocked')
const unreadCount = !shouldIgnore && convo.view.unreadCount > 0 ? 1 : 0
const unreadJoinRequestCount =
convo.kind === 'group'
? (convo.details.unreadJoinRequestCount ?? 0)
: 0
const unreadCount =
!shouldIgnore &&
(convo.view.unreadCount > 0 || unreadJoinRequestCount > 0)
? 1
: 0
return acc + unreadCount
}, 0) ?? 0