Remove fake/periodic notifications (spam)
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:
@@ -58,7 +58,6 @@ export class SignalrService implements OnlineService {
|
||||
private chatCbs = new Set<(id: string, m: ChatMessage[]) => void>();
|
||||
private forfeitCbs = new Set<(r: ForfeitRequest | null) => void>();
|
||||
private cachedProfile: UserProfile | null = null;
|
||||
private mockNotifUnsub?: () => void;
|
||||
|
||||
constructor() {
|
||||
if (typeof window !== "undefined") {
|
||||
@@ -385,10 +384,9 @@ export class SignalrService implements OnlineService {
|
||||
onChat(cb: (id: string, m: ChatMessage[]) => void) { this.chatCbs.add(cb); return () => this.chatCbs.delete(cb); }
|
||||
|
||||
onNotification(cb: (n: AppNotification) => void): Unsubscribe {
|
||||
// Real notifications only — server hub "notification" events + app-generated
|
||||
// ones (friend requests, achievements, daily, payment). No fake spam.
|
||||
this.notifCbs.add(cb);
|
||||
// also forward the mock's periodic notifications for liveliness
|
||||
if (!this.mockNotifUnsub)
|
||||
this.mockNotifUnsub = this.mock.onNotification((n) => this.notifCbs.forEach((c) => c(n)));
|
||||
return () => this.notifCbs.delete(cb);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user