dkforest

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

commit 176bfd62a796311187df17a74654a4d3f640243a
parent e7c3de3e000e9cd7ba161d25960a06d6ab3d125a
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 17 May 2023 16:29:45 -0700

prevent leaking hb info

Diffstat:
Mpkg/web/handlers/api/v1/handlers.go | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/api/v1/handlers.go b/pkg/web/handlers/api/v1/handlers.go @@ -209,6 +209,12 @@ func ChatMessagesHandler(c echo.Context) error { return c.NoContent(status) } if c.QueryParams().Has("json") { + authUser := c.Get("authUser").(*database.User) + if authUser.IsHellbanned || (!authUser.IsModerator() && !authUser.CanSeeHellbanned) { + for i := range data.Messages { + data.Messages[i].IsHellbanned = false + } + } return c.JSON(http.StatusOK, data) } return c.Render(http.StatusOK, "chat-messages", data)