mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 00:25:17 +00:00
Notify through websocket new number of notifications
This commit is contained in:
@ -13,11 +13,17 @@ export interface DestroyedLoginTokensEvent {
|
||||
client: APIClient
|
||||
}
|
||||
|
||||
// When some user might have an updated number of notifications
|
||||
export interface UpdatedNotificationsNumberEvent {
|
||||
usersID: number[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Global map of all possible events
|
||||
*/
|
||||
export interface EventsMap {
|
||||
"destroyed_login_tokens": DestroyedLoginTokensEvent
|
||||
"destroyed_login_tokens": DestroyedLoginTokensEvent,
|
||||
"updated_number_notifications": UpdatedNotificationsNumberEvent,
|
||||
}
|
||||
|
||||
export class EventsHelper {
|
||||
|
@ -6,6 +6,7 @@ import { PostPageKind, PostVisibilityLevel } from "../entities/Post";
|
||||
import { FriendsHelper } from "./FriendsHelper";
|
||||
import { GroupsHelper } from "./GroupsHelper";
|
||||
import { GroupMembershipLevels } from "../entities/GroupMember";
|
||||
import { EventsHelper } from "./EventsHelper";
|
||||
|
||||
/**
|
||||
* Notifications helper
|
||||
@ -308,6 +309,9 @@ export class NotificationsHelper {
|
||||
NOTIFICATIONS_TABLE,
|
||||
this.NotifToDB(n, true)
|
||||
)
|
||||
|
||||
// Trigger notify system
|
||||
await EventsHelper.Emit("updated_number_notifications", {usersID: [n.destUserID]});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user