diff --git a/apps/simplex-directory-service/src/Directory/Service.hs b/apps/simplex-directory-service/src/Directory/Service.hs index c5c41e39be..fc9ac24e71 100644 --- a/apps/simplex-directory-service/src/Directory/Service.hs +++ b/apps/simplex-directory-service/src/Directory/Service.hs @@ -699,11 +699,6 @@ directoryServiceEvent st opts@DirectoryOpts {adminUsers, superUsers, serviceName DCListUserGroups -> getUserGroupRegs st (contactId' ct) >>= \grs -> do 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} -> sendGroupInfo ct gr userGroupRegId Nothing DCDeleteGroup gId gName -> diff --git a/apps/simplex-directory-service/src/Directory/Store.hs b/apps/simplex-directory-service/src/Directory/Store.hs index 031d05fd49..628419ea1d 100644 --- a/apps/simplex-directory-service/src/Directory/Store.hs +++ b/apps/simplex-directory-service/src/Directory/Store.hs @@ -212,7 +212,7 @@ delGroupReg st GroupReg {dbGroupId = gId, groupRegStatus} = do logGDelete st gId atomically $ writeTVar groupRegStatus GRSRemoved atomically $ unlistGroup st gId - atomically $ modifyTVar' (groupRegs st) $ filter ((gId ==) . dbGroupId) + atomically $ modifyTVar' (groupRegs st) $ filter ((gId /=) . dbGroupId) setGroupStatus :: DirectoryStore -> GroupReg -> GroupRegStatus -> IO () setGroupStatus st gr grStatus = do diff --git a/tests/Bots/DirectoryTests.hs b/tests/Bots/DirectoryTests.hs index 92d70727e3..0877a48daa 100644 --- a/tests/Bots/DirectoryTests.hs +++ b/tests/Bots/DirectoryTests.hs @@ -299,10 +299,12 @@ testDeleteGroupAdmin ps = superUser #> "@SimpleX-Directory /delete 2:security" superUser <# "SimpleX-Directory> > /delete 2:security" superUser <## " The group security is deleted from the directory" - groupFound bob "privacy" + groupFound cath "privacy" + listUserGroup bob "privacy" "Privacy" groupNotFound bob "security" + sendListCommand cath 0 -- 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 ps =