core: create knocking message for moderators (#5857)

This commit is contained in:
spaced4ndy
2025-04-28 10:45:42 +00:00
committed by GitHub
parent 60bfd9933a
commit dd01ef5ae8
6 changed files with 22 additions and 1 deletions

View File

@@ -790,6 +790,10 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
else pure $ memberStatus m
(gInfo', m', scopeInfo) <- mkGroupChatScope gInfo m
memberConnectedChatItem gInfo' scopeInfo m'
case scopeInfo of
Just (GCSIMemberSupport _) -> do
createInternalChatItem user (CDGroupRcv gInfo' scopeInfo m') (CIRcvGroupEvent RGENewMemberPendingReview) Nothing
_ -> pure ()
toView $ CRJoinedGroupMember user gInfo' m' {memberStatus = mStatus}
let Connection {viaUserContactLink} = conn
when (isJust viaUserContactLink && isNothing (memberContactId m')) $ sendXGrpLinkMem gInfo'
@@ -2467,6 +2471,10 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
let event = RGEMemberAdded groupMemberId (fromLocalProfile memberProfile)
ci <- saveRcvChatItemNoParse user (CDGroupRcv gInfo scopeInfo m) msg brokerTs (CIRcvGroupEvent event)
groupMsgToView gInfo scopeInfo ci
case scopeInfo of
Just (GCSIMemberSupport _) -> do
createInternalChatItem user (CDGroupRcv gInfo scopeInfo m) (CIRcvGroupEvent RGENewMemberPendingReview) (Just brokerTs)
_ -> pure ()
toView $ CRJoinedGroupMemberConnecting user gInfo m announcedMember'
getMemNewChatScope announcedMember = case msgScope_ of
Nothing -> pure (announcedMember, Nothing)

View File

@@ -219,6 +219,7 @@ ciRequiresAttention content = case msgDirection @d of
RGEInvitedViaGroupLink -> False
RGEMemberCreatedContact -> False
RGEMemberProfileUpdated {} -> False
RGENewMemberPendingReview -> True
CIRcvConnEvent _ -> True
CIRcvChatFeature {} -> False
CIRcvChatPreference {} -> False
@@ -332,6 +333,7 @@ rcvGroupEventToText = \case
RGEInvitedViaGroupLink -> "invited via your group link"
RGEMemberCreatedContact -> "started direct connection with you"
RGEMemberProfileUpdated {} -> "updated profile"
RGENewMemberPendingReview -> "new member wants to join the group"
sndGroupEventToText :: SndGroupEvent -> Text
sndGroupEventToText = \case

View File

@@ -31,6 +31,7 @@ data RcvGroupEvent
| RGEInvitedViaGroupLink -- CRSentGroupInvitationViaLink
| RGEMemberCreatedContact -- CRNewMemberContactReceivedInv
| RGEMemberProfileUpdated {fromProfile :: Profile, toProfile :: Profile} -- CRGroupMemberUpdated
| RGENewMemberPendingReview
deriving (Show)
data SndGroupEvent