mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-21 21:09:22 +00:00
Can delete group membership notifications
This commit is contained in:
parent
900ed3cf98
commit
890e49a4ae
@ -80,7 +80,7 @@ export class NotificationsUtils {
|
||||
* @param kind The kind of notification to create
|
||||
*/
|
||||
public static async CreateGroupMembershipNotification(userID: number, moderatorID: number, groupID: number, kind: NotifEventType) {
|
||||
// TODO : Delete all previous notifications
|
||||
await this.DeleteNotificationsGroupsMembership(userID, groupID);
|
||||
|
||||
const n = new Notif({
|
||||
onElemID: groupID,
|
||||
@ -104,4 +104,27 @@ export class NotificationsUtils {
|
||||
|
||||
await NotificationsHelper.Push(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the notifications related to a specific group membership
|
||||
*
|
||||
* @param userID Target user
|
||||
* @param groupID The ID of the target group
|
||||
*/
|
||||
public static async DeleteNotificationsGroupsMembership(userID: number, groupID: number) {
|
||||
|
||||
const n = new Notif({
|
||||
onElemType: NotifElemType.GROUP_MEMBERSHIP,
|
||||
onElemID: groupID
|
||||
});
|
||||
|
||||
n.destUserID = userID;
|
||||
n.fromUserID = -1;
|
||||
await NotificationsHelper.Delete(n);
|
||||
|
||||
n.destUserID = -1;
|
||||
n.fromUserID = userID;
|
||||
await NotificationsHelper.Delete(n);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user