mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-11 20:38:55 +00:00
android, desktop, ios: scope media support-message preview to pending invitee only
The prior change to render caption-less media (instead of the status text) used the shared ChatPreviewView condition, so it affected every chat with a status preview (direct connection states, other group states). Gate it on memberPending so only the pending invitee's member-support preview changes; all other chats keep the original hasMsgContent behaviour.
This commit is contained in:
@@ -347,12 +347,13 @@ struct ChatPreviewView: View {
|
||||
}
|
||||
|
||||
@ViewBuilder private func chatMessagePreview(_ cItem: ChatItem?, _ hasFilePreview: Bool = false) -> some View {
|
||||
// pending invitee only: a member-support message (incl. caption-less media) renders its content,
|
||||
// not the "reviewed by admins" status; other chats keep the original no-text behaviour
|
||||
let previewHasNoContent = chat.chatInfo.groupInfo?.membership.memberPending ?? false ? cItem?.content.msgContent == nil : cItem?.content.hasMsgContent != true
|
||||
if chatModel.draftChatId == chat.id, let draft = chatModel.draft {
|
||||
let (t, hasSecrets) = messageDraft(draft)
|
||||
chatPreviewLayout(t, draft: true, hasFilePreview: hasFilePreview, hasSecrets: hasSecrets)
|
||||
} else if cItem?.content.msgContent == nil, let previewText = chatPreviewInfoText() {
|
||||
// status text only for no-content events; any message (incl. caption-less media) renders
|
||||
// its content (thumbnail shown separately) - e.g. a pending invitee's photo shows "image"
|
||||
} else if previewHasNoContent, let previewText = chatPreviewInfoText() {
|
||||
chatPreviewInfoTextLayout(previewText)
|
||||
} else if let cItem = cItem {
|
||||
let (t, hasSecrets) = chatItemPreview(cItem)
|
||||
|
||||
+4
-3
@@ -218,6 +218,9 @@ fun ChatPreviewView(
|
||||
fun chatPreviewText() {
|
||||
val previewText = chatPreviewInfoText()
|
||||
val ci = chat.chatItems.lastOrNull()
|
||||
// pending invitee only: a member-support message (incl. caption-less media) renders its content, not
|
||||
// the "reviewed by admins" status; other chats keep the original no-text behaviour
|
||||
val previewHasNoContent = if (cInfo.groupInfo_?.membership?.memberPending == true) ci?.content?.msgContent == null else ci?.content?.hasMsgContent != true
|
||||
if (chatModelDraftChatId == chat.id && chatModelDraft != null) {
|
||||
val sp20 = with(LocalDensity.current) { 20.sp.toDp() }
|
||||
val (text: CharSequence, inlineTextContent) = remember(chatModelDraft) { chatModelDraft.message.text to messageDraft(chatModelDraft, sp20) }
|
||||
@@ -238,9 +241,7 @@ fun ChatPreviewView(
|
||||
inlineContent = inlineTextContent,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
} else if (ci?.content?.msgContent == null && previewText != null) {
|
||||
// status text only for no-content events; any message (incl. caption-less media) renders its
|
||||
// content (thumbnail shown separately) - e.g. a pending invitee's photo shows "image", not the status
|
||||
} else if (previewHasNoContent && previewText != null) {
|
||||
Text(previewText.first, color = previewText.second)
|
||||
} else if (ci != null && showChatPreviews) {
|
||||
val (text: CharSequence, inlineTextContent) = when {
|
||||
|
||||
Reference in New Issue
Block a user