mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 20:29:53 +00:00
directory service: fix deleting group registration (#5856)
This commit is contained in:
parent
7cac164b84
commit
ca49167ec6
3 changed files with 5 additions and 8 deletions
|
@ -699,11 +699,6 @@ directoryServiceEvent st opts@DirectoryOpts {adminUsers, superUsers, serviceName
|
||||||
DCListUserGroups ->
|
DCListUserGroups ->
|
||||||
getUserGroupRegs st (contactId' ct) >>= \grs -> do
|
getUserGroupRegs st (contactId' ct) >>= \grs -> do
|
||||||
sendReply $ tshow (length grs) <> " registered group(s)"
|
sendReply $ tshow (length grs) <> " registered group(s)"
|
||||||
-- debug how it can be that user has 0 registered groups
|
|
||||||
when (length grs == 0) $ do
|
|
||||||
total <- length <$> readTVarIO (groupRegs st)
|
|
||||||
withSuperUsers $ \ctId -> sendMessage' cc ctId $
|
|
||||||
"0 registered groups for " <> localDisplayName' ct <> " (" <> tshow (contactId' ct) <> ") out of " <> tshow total <> " registrations"
|
|
||||||
void . forkIO $ forM_ (reverse grs) $ \gr@GroupReg {userGroupRegId} ->
|
void . forkIO $ forM_ (reverse grs) $ \gr@GroupReg {userGroupRegId} ->
|
||||||
sendGroupInfo ct gr userGroupRegId Nothing
|
sendGroupInfo ct gr userGroupRegId Nothing
|
||||||
DCDeleteGroup gId gName ->
|
DCDeleteGroup gId gName ->
|
||||||
|
|
|
@ -212,7 +212,7 @@ delGroupReg st GroupReg {dbGroupId = gId, groupRegStatus} = do
|
||||||
logGDelete st gId
|
logGDelete st gId
|
||||||
atomically $ writeTVar groupRegStatus GRSRemoved
|
atomically $ writeTVar groupRegStatus GRSRemoved
|
||||||
atomically $ unlistGroup st gId
|
atomically $ unlistGroup st gId
|
||||||
atomically $ modifyTVar' (groupRegs st) $ filter ((gId ==) . dbGroupId)
|
atomically $ modifyTVar' (groupRegs st) $ filter ((gId /=) . dbGroupId)
|
||||||
|
|
||||||
setGroupStatus :: DirectoryStore -> GroupReg -> GroupRegStatus -> IO ()
|
setGroupStatus :: DirectoryStore -> GroupReg -> GroupRegStatus -> IO ()
|
||||||
setGroupStatus st gr grStatus = do
|
setGroupStatus st gr grStatus = do
|
||||||
|
|
|
@ -299,10 +299,12 @@ testDeleteGroupAdmin ps =
|
||||||
superUser #> "@SimpleX-Directory /delete 2:security"
|
superUser #> "@SimpleX-Directory /delete 2:security"
|
||||||
superUser <# "SimpleX-Directory> > /delete 2:security"
|
superUser <# "SimpleX-Directory> > /delete 2:security"
|
||||||
superUser <## " The group security is deleted from the directory"
|
superUser <## " The group security is deleted from the directory"
|
||||||
groupFound bob "privacy"
|
groupFound cath "privacy"
|
||||||
|
listUserGroup bob "privacy" "Privacy"
|
||||||
groupNotFound bob "security"
|
groupNotFound bob "security"
|
||||||
|
sendListCommand cath 0
|
||||||
-- another user can register the group with the same name
|
-- another user can register the group with the same name
|
||||||
registerGroupId superUser bob "security" "Security" 4 1
|
registerGroupId superUser bob "security" "Security" 4 2
|
||||||
|
|
||||||
testSetRole :: HasCallStack => TestParams -> IO ()
|
testSetRole :: HasCallStack => TestParams -> IO ()
|
||||||
testSetRole ps =
|
testSetRole ps =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue