android, desktop: show pending invitee's received support messages in chat list preview

- Narrow the sent-item mirror (previous commit) to GroupChatScopeContext (member
  support); the reports view has no compose, so it shouldn't trigger it.
- A pending invitee's RECEIVED support message was dropped from the main chat list
  preview: the group preview keeps the higher-itemTs item, but a received message's
  itemTs is the broker clock while the placeholder group event's itemTs is the local
  device clock - an unreliable cross-clock comparison. Bypass it when memberPending
  so received support items surface in the preview the same way sent ones do.
This commit is contained in:
Narasimha-sc
2026-06-18 11:05:56 +00:00
parent 862d93c647
commit bd7c6c3e85
@@ -520,9 +520,10 @@ object ChatModel {
}
suspend fun addChatItem(rhId: Long?, chatInfo: ChatInfo, cItem: ChatItem) {
// Sent items reach only the active context; received items reach both. Mirror that so a message
// sent in a secondary scope (member support) still updates the main chat list preview (#5909).
if (secondaryContextFilter != null && cItem.chatDir.sent) {
// A message sent in a member-support scope ("chat with admins") is added only to that secondary
// context; received items reach both. Mirror it so the send still updates the main chat list
// preview (e.g. a pending invitee's own message) - #5909.
if (secondaryContextFilter is SecondaryContextFilter.GroupChatScopeContext && cItem.chatDir.sent) {
chatsContext.addChatItem(rhId, chatInfo, cItem)
}
// updates membersRequireAttention
@@ -545,7 +546,11 @@ object ChatModel {
is ChatInfo.Group -> {
val currentPreviewItem = chat.chatItems.firstOrNull()
if (currentPreviewItem != null) {
if (cItem.meta.itemTs >= currentPreviewItem.meta.itemTs) {
// For a pending invitee the support item (received via the broker clock) is the
// reason this preview updates; its itemTs isn't comparable to a locally-stamped
// group event, so always surface it rather than dropping it on a cross-clock check.
if (cInfo.groupInfo_?.membership?.memberPending == true ||
cItem.meta.itemTs >= currentPreviewItem.meta.itemTs) {
cItem
} else {
currentPreviewItem