core: ignore mentions and replies of blocked members (#7303)

Messages of blocked members are hidden, but they still marked chat item
as user mention, showing mention badge and counting group as unread in
"mentions only" notification mode:
- createNonLive passed mentions unfiltered, allowing members blocked by
  admin to mention user - it is the default path, as it is only used
  when full delete is not allowed;
- userReply was set for replies to user messages from blocked members.
This commit is contained in:
Narasimha-sc
2026-07-25 10:42:34 +01:00
committed by GitHub
parent e7c94472c4
commit 3726040d84
3 changed files with 76 additions and 2 deletions
+5 -1
View File
@@ -2811,7 +2811,11 @@ saveRcvChatItem' user cd msg@RcvMessage {chatMsgEvent, msgSigned, forwardedByMem
where
groupMentions db g membership = do
mentions' <- getRcvCIMentions db user g ft_ mentions
let userReply = case cmToQuotedMsg chatMsgEvent of
-- messages of blocked members are hidden, they should not mention user
let senderBlocked = case cd of
CDGroupRcv _g _scope m -> memberBlocked m
_ -> False
userReply = not senderBlocked && case cmToQuotedMsg chatMsgEvent of
Just QuotedMsg {msgRef = MsgRef {memberId = Just mId}} -> sameMemberId mId membership
_ -> False
userMention' = userReply || any (\CIMention {memberId} -> sameMemberId memberId membership) mentions'
+2 -1
View File
@@ -2221,7 +2221,8 @@ processAgentMessageConn cxt user@User {userId} corrId agentConnId agentMessage =
toView $ CEvtChatItemsDeleted user deletions False False
-- m' is Maybe GroupMember
createNonLive gInfo' m' scopeInfo file_ = do
saveRcvCI gInfo' m' scopeInfo (CIRcvMsgContent content, ts) (snd <$> file_) (timed_ gInfo') False mentions
let mentions' = if maybe False memberBlocked m' then M.empty else mentions
saveRcvCI gInfo' m' scopeInfo (CIRcvMsgContent content, ts) (snd <$> file_) (timed_ gInfo') False mentions'
createContentItem gInfo' m' scopeInfo = do
file_ <- processFileInv gInfo' m'
newChatItem gInfo' m' scopeInfo (CIRcvMsgContent content, ts) (snd <$> file_) (timed_ gInfo') live'