mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-11 22:48:56 +00:00
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:
@@ -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]
|
||||
|
||||
+6
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user