dkforest

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

commit b3f01a1ab72b9a1d84ba73b7cecf091f35576349
parent 10b0eb0e48fb6577b40fef0d83419dfb35070928
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat, 27 May 2023 18:01:11 -0700

cleanup

Diffstat:
Mpkg/database/tableChatReadMarkers.go | 1+
Mpkg/web/handlers/api/v1/msgInterceptor.go | 1-
Mpkg/web/handlers/handlers.go | 2+-
3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/database/tableChatReadMarkers.go b/pkg/database/tableChatReadMarkers.go @@ -24,4 +24,5 @@ func (d *DkfDB) UpdateChatReadMarker(userID UserID, roomID RoomID) { if res.RowsAffected == 0 { d.db.Create(ChatReadMarker{UserID: userID, RoomID: roomID, ReadAt: now}) } + MsgPubSub.Pub("readmarker_"+userID.String(), ChatMessageType{}) } diff --git a/pkg/web/handlers/api/v1/msgInterceptor.go b/pkg/web/handlers/api/v1/msgInterceptor.go @@ -54,7 +54,6 @@ func (i MsgInterceptor) InterceptMsg(cmd *Command) { // Update chat read marker cmd.db.UpdateChatReadMarker(cmd.authUser.ID, cmd.room.ID) - database.MsgPubSub.Pub("readmarker_"+string(cmd.authUser.Username), database.ChatMessageType{}) // Update user activity isPM := cmd.toUser != nil diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -5079,7 +5079,7 @@ func ChatStreamMessagesHandler(c echo.Context) error { c.Response().Flush() selfRefreshTopic := "refresh_" + string(authUser.Username) - readMarkerTopic := "readmarker_" + string(authUser.Username) + readMarkerTopic := "readmarker_" + authUser.ID.String() authorizedChannels := []string{ "refresh", selfRefreshTopic,