mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-27 22:34:51 +00:00
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:
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user