dkforest

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

commit 8c3e701c9b2e97b3b60f0e0ce8e327d2b977b68c
parent 996643ecf2a58b8b708a33322bd82f0f9188a63d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 24 May 2023 06:45:05 -0700

simplify code

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

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -5024,7 +5024,7 @@ func ChatStreamMessagesHandler(c echo.Context) error { defer sub.Close() i := 0 - indicatorIdx := 0 + var indicatorSelector bool Loop: for { select { @@ -5043,9 +5043,9 @@ Loop: db.UpdateChatReadRecord(authUser.ID, room.ID) _, _ = c.Response().Write([]byte(fmt.Sprintf(`<style>#http-alive-indicator{background-color:#008000;animation: %s 10s forwards;}</style>`, - utils.Ternary(indicatorIdx%2 == 0, "indicator1", "indicator2")))) + utils.Ternary(indicatorSelector, "indicator1", "indicator2")))) c.Response().Flush() - indicatorIdx++ + indicatorSelector = !indicatorSelector _, msgTyp, err := sub.ReceiveTimeout2(5*time.Second, quit, quit1) if err != nil {