diff --git a/src/Simplex/Chat/Library/Subscriber.hs b/src/Simplex/Chat/Library/Subscriber.hs index 51dc49c423..891581b112 100644 --- a/src/Simplex/Chat/Library/Subscriber.hs +++ b/src/Simplex/Chat/Library/Subscriber.hs @@ -3123,8 +3123,6 @@ processAgentMessageConn cxt user@User {userId} corrId agentConnId agentMessage = messageError "x.grp.mem.role with insufficient member permissions" $> Nothing | otherwise = do withStore' $ \db -> updateGroupMemberRole db user member memRole - when (memberId' member == membershipMemId && memRole < GRAdmin) $ - deleteGroupLinkIfExists user gInfo' (gInfo'', m', scopeInfo) <- mkGroupChatScope gInfo' m (ci, cInfo) <- saveRcvChatItemNoParse user (CDGroupRcv gInfo'' scopeInfo m') msg brokerTs (CIRcvGroupEvent gEvent) groupMsgToView cInfo ci diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index ee21ec8c0c..c8cd1c5f30 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -109,7 +109,7 @@ chatGroupTests = do it "invitee incognito" testGroupLinkInviteeIncognito it "incognito - join/invite" testGroupLinkIncognitoJoinInvite it "group link member role" testGroupLinkMemberRole - it "demoted admin cannot keep using group link" testGroupLinkDemotedAdmin + it "demotion does not remove group link" testGroupLinkDemotedAdmin it "host profile received" testGroupLinkHostProfileReceived it "existing contact merged" testGroupLinkExistingContactMerged describe "group links - member screening" $ do @@ -2977,8 +2977,9 @@ testGroupLinkDemotedAdmin = bob <## "#team: alice changed your role from admin to member" ] + -- demotion does not remove bob's group link (it is preserved, usable again on re-promotion) bob ##> "/show link #team" - bob <## "#team: you have insufficient permissions for this action, the required role is admin" + void $ getGroupLink bob "team" GRMember False testGroupLinkHostIncognito :: HasCallStack => TestParams -> IO () testGroupLinkHostIncognito =