dkforest

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

commit 0bbf39220109592204501c78a567948fb2c4abed
parent a5087743cdcc4c0bbe63b00949ec334ed591814b
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 19 Dec 2023 22:56:01 -0500

hide timestamps in embedded poker chat

Diffstat:
Mpkg/web/handlers/api/v1/chat.go | 6++++++
Mpkg/web/handlers/api/v1/data.go | 3++-
Mpkg/web/handlers/api/v1/messages.qtpl | 2+-
Mpkg/web/handlers/api/v1/messages.qtpl.go | 2+-
Mpkg/web/handlers/poker/poker.go | 2+-
5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/pkg/web/handlers/api/v1/chat.go b/pkg/web/handlers/api/v1/chat.go @@ -123,6 +123,12 @@ func ChatStreamMessagesHandler(c echo.Context) error { data.HideRightColumn = true } + if authUser.GetDateFormat() == "" { + data.HideTimestamps = true + } else if _, found := c.QueryParams()["hide_ts"]; found { + data.HideTimestamps = true + } + // Register modals and send the css for them modalsManager := streamModals.NewModalsManager() modalsManager.Register(streamModals.NewCodeModal(authUser.ID, room)) diff --git a/pkg/web/handlers/api/v1/data.go b/pkg/web/handlers/api/v1/data.go @@ -36,7 +36,6 @@ type ChatMenuData struct { RoomName string TopBarQueryParams string PreventRefresh bool - HideRightColumn bool } type ChatMessagesData struct { @@ -52,6 +51,8 @@ type ChatMessagesData struct { PmSound bool Error string ErrorTs int64 + HideRightColumn bool + HideTimestamps bool } func (c ChatMessagesData) MarshalJSON() ([]byte, error) { diff --git a/pkg/web/handlers/api/v1/messages.qtpl b/pkg/web/handlers/api/v1/messages.qtpl @@ -394,7 +394,7 @@ <div class="spacer16"></div> {%- endif -%} {%- endif -%} - {%- if AuthUser.GetDateFormat() != "" -%} + {%- if !Data.HideTimestamps -%} <a href="{%s baseTopBarURL %}?quote={%s e.UUID %}{%= unesc(Data.TopBarQueryParams) %}" target="iframe1" class="date date-link" title="{%s e.CreatedAt.Format("01-02 15:04:05") %}{% if *isFirstMsg %} ({%s humanize.Time(e.CreatedAt) %}){% endif %}">{%s e.CreatedAt.Format(AuthUser.GetDateFormat()) %}</a> {% code *isFirstMsg = false %} {%- endif -%} diff --git a/pkg/web/handlers/api/v1/messages.qtpl.go b/pkg/web/handlers/api/v1/messages.qtpl.go @@ -953,7 +953,7 @@ func StreamRenderMessage(qw422016 *qt422016.Writer, idx int, e database.ChatMess //line messages.qtpl:396 } //line messages.qtpl:397 - if AuthUser.GetDateFormat() != "" { + if !Data.HideTimestamps { //line messages.qtpl:397 qw422016.N().S(` <a href="`) //line messages.qtpl:398 diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1605,7 +1605,7 @@ func BuildBaseHtml(g *PokerGame, authUser *database.User) (html string) { html += buildHelpHtml() html += `<div id="chat-div">` html += ` <iframe id="chat-top-bar" name="iframe1" src="/api/v1/chat/top-bar/general" sandbox="allow-forms allow-scripts allow-same-origin allow-top-navigation-by-user-activation"></iframe>` - html += ` <iframe id="chat-content" name="iframe2" src="/api/v1/chat/messages/general/stream?hrm=1&hactions=1"></iframe>` + html += ` <iframe id="chat-content" name="iframe2" src="/api/v1/chat/messages/general/stream?hrm=1&hactions=1&hide_ts=1"></iframe>` html += `</div>` html += `<iframe src="/poker/` + roomID.String() + `/logs" id="eventLogs"></iframe>`