From 14fd211b654d9fd9bc610787a42782508dd74ee7 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Fri, 24 Nov 2023 23:06:35 -0500 Subject: [PATCH] Allow global mods to delete comments --- helper/moderation.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/helper/moderation.go b/helper/moderation.go index cedde45..b851f21 100644 --- a/helper/moderation.go +++ b/helper/moderation.go @@ -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