Skip to content

Commit

Permalink
Allow global mods to delete comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarebczan committed Nov 25, 2023
1 parent d72d655 commit 14fd211
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions helper/moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ func GetModerator(modChannelID, modChannelName, creatorChannelID, creatorChannel
if err != nil {
return nil, nil, errors.Err(err)
}
if !exists {
return nil, nil, errors.Err("%s is not delegated by %s to be a moderator", modChannel.Name, creatorChannel.Name)
isGlobalMod, err := modChannel.ModChannelModerators().Exists(db.RO)
if err != nil {
return nil, nil, errors.Err(err)
}
// check if exists and if not check if the mod is a global mod
if !exists || !isGlobalMod {
return nil, nil, errors.Err("%s is not delegated by %s to be a moderator, or isn't a global mod", modChannel.Name, creatorChannel.Name)
}
}
return modChannel, creatorChannel, nil
Expand Down

0 comments on commit 14fd211

Please sign in to comment.