v3: follows, notifications, invite-only registration, unread markers

This commit is contained in:
khannurien
2026-03-21 18:42:47 +00:00
parent 7c098e7c4c
commit 608c6bc6a8
55 changed files with 4743 additions and 884 deletions

View File

@@ -13,6 +13,7 @@ import {
getUserVotes,
removeVote,
} from "../services/vote-service.ts";
import { getUnreadCount } from "../services/notification-service.ts";
import { getUserById } from "../services/user-service.ts";
import { APIException } from "../model/interfaces.ts";
@@ -61,10 +62,14 @@ router.get("/ws", async (ctx) => {
try {
const myVotes = authPayload ? getUserVotes(authPayload.userId) : [];
const unreadNotificationCount = authPayload
? getUnreadCount(authPayload.userId)
: 0;
socket.send(JSON.stringify({
type: "welcome",
users: getOnlineUsers(),
myVotes,
unreadNotificationCount,
}));
} catch (err) {
console.error("[ws] welcome send failed:", err);