dkforest

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

commit d3e8c249fd0a6794e921d6e4c5a99ea45bf87e71
parent 940ef55429ca04dd0c52010a9b8d633149cf08a6
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon,  1 Jan 2024 15:53:03 -0500

cleanup

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

diff --git a/pkg/web/handlers/api/v1/chat.go b/pkg/web/handlers/api/v1/chat.go @@ -131,6 +131,11 @@ func ChatStreamMessagesHandler(c echo.Context) error { authUser := c.Get("authUser").(*database.User) csrf, _ := c.Get("csrf").(string) + queryParams := c.QueryParams() + _, mlFound := queryParams["ml"] + _, hrmFound := queryParams["hrm"] + _, hideTsFound := queryParams["hide_ts"] + roomName := c.Param("roomName") room, roomKey, err := dutils.GetRoomAndKey(db, c, roomName) if err != nil { @@ -151,21 +156,12 @@ func ChatStreamMessagesHandler(c echo.Context) error { } data := ChatMessagesData{} - if _, found := c.QueryParams()["ml"]; found { + if mlFound { data.TopBarQueryParams = "&ml=1" } - if authUser.HideRightColumn { - data.HideRightColumn = true - } else if _, found := c.QueryParams()["hrm"]; found { - data.HideRightColumn = true - } - - if authUser.GetDateFormat() == "" { - data.HideTimestamps = true - } else if _, found := c.QueryParams()["hide_ts"]; found { - data.HideTimestamps = true - } + data.HideRightColumn = authUser.HideRightColumn || hrmFound + data.HideTimestamps = authUser.GetDateFormat() == "" || hideTsFound // Register modals and send the css for them modalsManager := streamModals.NewModalsManager()