From 83207304401304fa9d9725cb319f0fd3d5bcdd5a Mon Sep 17 00:00:00 2001 From: Evgeny Date: Fri, 24 Jul 2026 10:50:46 +0100 Subject: [PATCH] core: prohibit image previews when images are prohibited (#7296) --- src/Simplex/Chat/Library/Internal.hs | 2 +- src/Simplex/Chat/Protocol.hs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Simplex/Chat/Library/Internal.hs b/src/Simplex/Chat/Library/Internal.hs index 76deabbebb..271348b5d6 100644 --- a/src/Simplex/Chat/Library/Internal.hs +++ b/src/Simplex/Chat/Library/Internal.hs @@ -343,7 +343,7 @@ prohibitedGroupContent :: GroupInfo -> GroupMember -> Maybe GroupChatScopeInfo - prohibitedGroupContent gInfo@GroupInfo {membership = mem@GroupMember {memberRole = userRole}} m scopeInfo mc ft file_ sent | not supportAllowed = Just GFSupport | isVoice mc && not (groupFeatureMemberAllowed SGFVoice m gInfo) && not hostApprovalVoice = Just GFVoice - | isNothing scopeInfo && not (isVoice mc) && isJust file_ && not (groupFeatureMemberAllowed SGFFiles m gInfo) = Just GFFiles + | isNothing scopeInfo && not (isVoice mc) && (isJust file_ || isMedia mc) && not (groupFeatureMemberAllowed SGFFiles m gInfo) = Just GFFiles | isNothing scopeInfo && isReport mc && (badReportUser || not (groupFeatureAllowed SGFReports gInfo)) = Just GFReports | isNothing scopeInfo && prohibitedSimplexLinks gInfo m mc ft = Just GFSimplexLinks | otherwise = Nothing diff --git a/src/Simplex/Chat/Protocol.hs b/src/Simplex/Chat/Protocol.hs index 2863b20b4b..19ba3d022d 100644 --- a/src/Simplex/Chat/Protocol.hs +++ b/src/Simplex/Chat/Protocol.hs @@ -815,6 +815,13 @@ isVoice = \case MCVoice {} -> True _ -> False +isMedia :: MsgContent -> Bool +isMedia = \case + MCImage {} -> True + MCVideo {} -> True + MCFile {} -> True + _ -> False + isReport :: MsgContent -> Bool isReport = \case MCReport {} -> True