mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-30 20:45:49 +00:00
directory: fix double logic inversion on roles check, incorrect error message (#3944)
This commit is contained in:
@@ -177,8 +177,8 @@ directoryService st DirectoryOpts {superUsers, serviceName, searchResults, testi
|
||||
badRolesMsg :: GroupRolesStatus -> Maybe String
|
||||
badRolesMsg = \case
|
||||
GRSOk -> Nothing
|
||||
GRSServiceNotAdmin -> Just "You must have a group *owner* role to register the group"
|
||||
GRSContactNotOwner -> Just "You must grant directory service *admin* role to register the group"
|
||||
GRSServiceNotAdmin -> Just "You must grant directory service *admin* role to register the group"
|
||||
GRSContactNotOwner -> Just "You must have a group *owner* role to register the group"
|
||||
GRSBadRoles -> Just "You must have a group *owner* role and you must grant directory service *admin* role to register the group"
|
||||
|
||||
getGroupRolesStatus :: GroupInfo -> GroupReg -> IO (Maybe GroupRolesStatus)
|
||||
@@ -190,8 +190,8 @@ directoryService st DirectoryOpts {superUsers, serviceName, searchResults, testi
|
||||
groupRolesStatus :: GroupMemberRole -> GroupMemberRole -> GroupRolesStatus
|
||||
groupRolesStatus contactRole serviceRole = case (contactRole, serviceRole) of
|
||||
(GROwner, GRAdmin) -> GRSOk
|
||||
(_, GRAdmin) -> GRSServiceNotAdmin
|
||||
(GROwner, _) -> GRSContactNotOwner
|
||||
(_, GRAdmin) -> GRSContactNotOwner
|
||||
(GROwner, _) -> GRSServiceNotAdmin
|
||||
_ -> GRSBadRoles
|
||||
|
||||
getGroupMember :: GroupReg -> IO (Maybe GroupMember)
|
||||
|
||||
@@ -522,7 +522,7 @@ testNotApprovedBadRoles tmp =
|
||||
let approve = "/approve 1:privacy 1"
|
||||
superUser #> ("@SimpleX-Directory " <> approve)
|
||||
superUser <# ("SimpleX-Directory> > " <> approve)
|
||||
superUser <## " Group is not approved: user is not an owner."
|
||||
superUser <## " Group is not approved: SimpleX-Directory is not an admin."
|
||||
groupNotFound cath "privacy"
|
||||
bob ##> "/mr privacy SimpleX-Directory admin"
|
||||
bob <## "#privacy: you changed the role of SimpleX-Directory from member to admin"
|
||||
|
||||
Reference in New Issue
Block a user