android, desktop, ios: keep pending invitee preview on the support message, not a re-covering group event

A pending invitee's member-support no-content group events (SGEUserPendingReview on the
PendingApproval->PendingReview transition, member-connected/E2EE/feature items) are delivered
as new chat items in member-support scope. The pending preview took the newest item, so such
an event re-covered the first message and rendered as the static "reviewed by admins" text.
Prefer a content message: a no-content item no longer displaces an already-shown message.
This commit is contained in:
Narasimha-sc
2026-06-18 13:03:54 +00:00
parent 2bc40ad4c5
commit 5b37cf881b
2 changed files with 12 additions and 10 deletions
+6 -5
View File
@@ -661,11 +661,12 @@ final class ChatModel: ObservableObject {
chats[i].chatItems = switch cInfo {
case .group:
if let currentPreviewItem = chats[i].chatItems.first {
// 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 ?? false
|| cItem.meta.itemTs >= currentPreviewItem.meta.itemTs {
// For a pending invitee, surface the latest support message in the preview (its
// broker-clock itemTs isn't comparable to a locally-stamped group event), but don't
// let a no-content group event re-cover a message already shown ("reviewed by admins").
if cInfo.groupInfo?.membership.memberPending ?? false {
(cItem.content.hasMsgContent || !currentPreviewItem.content.hasMsgContent) ? [cItem] : [currentPreviewItem]
} else if cItem.meta.itemTs >= currentPreviewItem.meta.itemTs {
[cItem]
} else {
[currentPreviewItem]
@@ -546,11 +546,12 @@ object ChatModel {
is ChatInfo.Group -> {
val currentPreviewItem = chat.chatItems.firstOrNull()
if (currentPreviewItem != null) {
// 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) {
// For a pending invitee, surface the latest support message in the preview (its
// broker-clock itemTs isn't comparable to a locally-stamped group event), but don't
// let a no-content group event re-cover a message already shown ("reviewed by admins").
if (cInfo.groupInfo_?.membership?.memberPending == true) {
if (cItem.content.hasMsgContent || !currentPreviewItem.content.hasMsgContent) cItem else currentPreviewItem
} else if (cItem.meta.itemTs >= currentPreviewItem.meta.itemTs) {
cItem
} else {
currentPreviewItem