summaryrefslogtreecommitdiff
path: root/internal/server/api/helpers.go
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-02-04 19:37:06 +0200
committerKyren223 <Kyren223@proton.me>2025-02-04 19:37:06 +0200
commitf0607f16633d266f55a4b08f7edbbc13d08121ae (patch)
tree168d1e6c46ada637bba76c6a4bd5735af1a4e02a /internal/server/api/helpers.go
parent752403fd523f287020dfcc6cdd3bf6d304365672 (diff)
Server now also sends the last_read column to the client so the client
so the client can use it to persist notifications
Diffstat (limited to 'internal/server/api/helpers.go')
-rw-r--r--internal/server/api/helpers.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/server/api/helpers.go b/internal/server/api/helpers.go
index 27c6f55..2daeb9f 100644
--- a/internal/server/api/helpers.go
+++ b/internal/server/api/helpers.go
@@ -148,7 +148,7 @@ permitted_frequencies AS (
WHERE m.is_member = true AND (f.perms != 0 OR m.is_admin = true)
)
SELECT
- e.source_id,
+ e.source_id, e.last_read,
CASE
WHEN COUNT(m.id) = 0 THEN NULL
ELSE SUM(CASE WHEN (m.ping = 0 OR (m.ping = 1 AND pf.is_admin = true) OR m.ping = ?) THEN 1 ELSE 0 END)
@@ -173,11 +173,13 @@ func getNotifications(ctx context.Context, userId snowflake.ID) (packet.Notifica
var items packet.NotificationsInfo
for rows.Next() {
var source *snowflake.ID
+ var lastRead *int64
var pings *int64
- if err := rows.Scan(&source, &pings); err != nil {
+ if err := rows.Scan(&source, &lastRead, &pings); err != nil {
return packet.NotificationsInfo{}, err
}
items.Source = append(items.Source, *source)
+ items.LastRead = append(items.LastRead, *lastRead)
items.Pings = append(items.Pings, pings)
}
if err := rows.Close(); err != nil {