dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit b29b359f60840dffda8363bc45fd7775e4ecc9f8
parent 1bfad9d0bb4b1b4f039244a32071acf419162cf5
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 15 Feb 2023 06:08:20 -0800

only moderators can change these settings

Diffstat:
Mpkg/web/handlers/handlers.go | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -3117,11 +3117,7 @@ func changeSettingsForm(c echo.Context, data settingsChatData) error { authUser.ChatReadMarkerEnabled = data.ChatReadMarkerEnabled authUser.ChatReadMarkerColor = data.ChatReadMarkerColor authUser.ChatReadMarkerSize = data.ChatReadMarkerSize - authUser.DisplayHellbanned = data.DisplayHellbanned - authUser.DisplayModerators = data.DisplayModerators authUser.DisplayDeleteButton = data.DisplayDeleteButton - authUser.DisplayKickButton = data.DisplayKickButton - authUser.DisplayHellbanButton = data.DisplayHellbanButton authUser.HideIgnoredUsersFromList = data.HideIgnoredUsersFromList authUser.HideRightColumn = data.HideRightColumn authUser.ChatBarAtBottom = data.ChatBarAtBottom @@ -3137,6 +3133,14 @@ func changeSettingsForm(c echo.Context, data settingsChatData) error { //authUser.NotifyNewMessageSound = data.NotifyNewMessageSound //authUser.NotifyTaggedSound = data.NotifyTaggedSound //authUser.NotifyPmmedSound = data.NotifyPmmedSound + + if authUser.IsModerator() { + authUser.DisplayHellbanned = data.DisplayHellbanned + authUser.DisplayModerators = data.DisplayModerators + authUser.DisplayKickButton = data.DisplayKickButton + authUser.DisplayHellbanButton = data.DisplayHellbanButton + } + if err := database.DB.Save(authUser).Error; err != nil { logrus.Error(err) data.Error = err.Error()