commit f58d0cd45ff25c6879b13d6c1b1ef38878751bfd
parent 45eac0f94a6a0f18efc5fc1b91305f6e37f98feb
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 18 Jan 2023 18:04:40 -0800
move code
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/pkg/web/handlers/api/v1/topBarHandler.go b/pkg/web/handlers/api/v1/topBarHandler.go
@@ -241,12 +241,6 @@ func ChatTopBarHandler(c echo.Context) error {
if !room.HasAccess(c) {
return c.NoContent(http.StatusForbidden)
}
-
- // If the tutorial is not completed, just render the chat top-bar, no matter what.
- if (room.IsOfficialRoom() || (room.IsListed && !room.IsProtected())) && !authUser.TutorialCompleted() {
- return c.Render(http.StatusOK, "chat-top-bar", data)
- }
-
roomKey := ""
if room.IsProtected() {
key, err := hutils.GetRoomKeyCookie(c, int64(room.ID))
@@ -256,6 +250,11 @@ func ChatTopBarHandler(c echo.Context) error {
roomKey = key.Value
}
+ // If the tutorial is not completed, just render the chat top-bar, no matter what.
+ if (room.IsOfficialRoom() || (room.IsListed && !room.IsProtected())) && !authUser.TutorialCompleted() {
+ return c.Render(http.StatusOK, "chat-top-bar", data)
+ }
+
data.Message, err = getDataMessagePrefix(c, roomKey, room, authUser)
if err != nil {
return c.Redirect(http.StatusFound, "/api/v1/chat/top-bar/"+room.Name)