dkforest

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

commit 951d8c0fe3cf3f92fd7f471ec2493228daafe8cb
parent 36edd148babded2f801437d156262748c7cc86fc
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 30 Jan 2023 14:45:49 -0800

cleanup

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

diff --git a/pkg/web/handlers/api/v1/handlers.go b/pkg/web/handlers/api/v1/handlers.go @@ -226,7 +226,9 @@ func RoomNotifierHandler(c echo.Context) error { if len(msgs) > 0 { if lastKnownMsgDate, err := time.Parse(time.RFC3339Nano, lastKnownDate); err == nil { for _, msg := range msgs { - if msg.CreatedAt.Truncate(time.Second).After(lastKnownMsgDate.Truncate(time.Second)) { + lastKnownDateTrunc := lastKnownMsgDate.Truncate(time.Second) + createdAtTrunc := msg.CreatedAt.Truncate(time.Second) + if createdAtTrunc.After(lastKnownDateTrunc) { if msg.User.ID != authUser.ID { newMessageSound = true if strings.Contains(msg.Message, "@"+authUser.Username) { @@ -237,7 +239,7 @@ func RoomNotifierHandler(c echo.Context) error { } break } - } else if msg.CreatedAt.Truncate(time.Second).Before(lastKnownMsgDate.Truncate(time.Second)) { + } else if createdAtTrunc.Before(lastKnownMsgDate) { break } }