summaryrefslogtreecommitdiff
path: root/internal/router/client-cache.go
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2025-08-27 19:11:16 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2025-08-27 19:11:16 +0700
commit26c77e33356a519b3caaed44fd9d7f8722f41918 (patch)
tree467bc15626f59cf69846fe36c0e2786a30e383d2 /internal/router/client-cache.go
parentea8c6da9b8bafa1d4e5fe5a77fb306006db7d6f6 (diff)
downloadweb-26c77e33356a519b3caaed44fd9d7f8722f41918.tar.gz
web-26c77e33356a519b3caaed44fd9d7f8722f41918.zip
feat: add and show like count
feat: localize like button
Diffstat (limited to 'internal/router/client-cache.go')
-rw-r--r--internal/router/client-cache.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/router/client-cache.go b/internal/router/client-cache.go
index 3104a66..7d276b1 100644
--- a/internal/router/client-cache.go
+++ b/internal/router/client-cache.go
@@ -58,6 +58,13 @@ func (c *ClientCache) GetLikeStatus(id string, page string) bool {
return ok
}
+func (c *ClientCache) GetLikeCount(page string) int {
+ if userSet, ok := c.likePageMap[page]; ok {
+ return len(userSet)
+ }
+ return 0
+}
+
func (c *ClientCache) LikeOn(id string, page string) (alreadyLiked bool) {
if _, ok := c.mutexLikeMap[id]; !ok {
c.mutexLikeMap[id] = &sync.Mutex{}