Remove fake/periodic notifications (spam)
CI/CD / CI - API (dotnet build + engine sim) (push) Failing after 1m41s
CI/CD / CI - Web (tsc + next build) (push) Failing after 1m19s
CI/CD / Deploy - local stack (db + server + web) (push) Has been skipped

The mock emitted random "a friend is online / event is live" notifications on a
35s timer and the live service forwarded them. Dropped both — only real
notifications now fire (friend requests, achievements, daily reward, payment,
match-ended, and server hub events).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-05 00:38:08 +03:30
parent fd33f85e9c
commit 1ea3b2b8d2
2 changed files with 3 additions and 27 deletions
+1 -23
View File
@@ -475,34 +475,12 @@ export class MockOnlineService implements OnlineService {
/* --------------------------- notifications ------------------------- */
private notifCbs = new Set<(n: AppNotification) => void>();
private notifTimer: ReturnType<typeof setInterval> | null = null;
// Real notifications only — no periodic fake/"liveliness" spam.
onNotification(cb: (n: AppNotification) => void): Unsubscribe {
this.notifCbs.add(cb);
if (this.notifTimer == null) {
const samples: Array<Pick<AppNotification, "kind" | "titleFa" | "titleEn" | "icon">> = [
{ kind: "system", titleFa: "یک دوست آنلاین شد", titleEn: "A friend is online", icon: "👋" },
{ kind: "system", titleFa: "مسابقه‌ی امروز شروع شد", titleEn: "Today's event is live", icon: "🏆" },
{ kind: "invite", titleFa: "یک نفر دنبال هم‌بازیه", titleEn: "Someone is looking for a partner", icon: "🎴" },
];
this.notifTimer = setInterval(() => {
if (this.notifCbs.size === 0) return;
const s = pick(samples);
const n: AppNotification = {
id: rid("ntf"),
ts: Date.now(),
read: false,
...s,
};
for (const c of this.notifCbs) c(n);
}, 35000);
}
return () => {
this.notifCbs.delete(cb);
if (this.notifCbs.size === 0 && this.notifTimer) {
clearInterval(this.notifTimer);
this.notifTimer = null;
}
};
}