From 5de78ce21151d8c67573229e94b667720a15674e Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Sun, 21 Jun 2026 20:39:30 +0000 Subject: [PATCH] do not remove link --- src/Simplex/Chat/Library/Subscriber.hs | 2 -- tests/ChatTests/Groups.hs | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) 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 =