mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-12-26 13:38:52 +00:00
Handles comments creation notification
This commit is contained in:
parent
0882ac76b3
commit
ab645b67ff
@ -48,7 +48,8 @@ export class CommentsController {
|
||||
// Create notifications
|
||||
await NotificationsHelper.CreatePostNotification(h.getUserId(), postID, NotifEventType.COMMENT_CREATED);
|
||||
|
||||
// TODO : Delete any notifications targetting this user about the post
|
||||
// Delete any notifications targetting this user about the post
|
||||
await NotificationsHelper.DeleteAllPostsNotificationsTargetingUser(h.getUserId(), postID);
|
||||
|
||||
h.send({success: true, commentID: commentID});
|
||||
}
|
||||
|
@ -370,6 +370,21 @@ export class NotificationsHelper {
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the notifications about a post targetting a specified
|
||||
* user
|
||||
*
|
||||
* @param userID Target user ID
|
||||
* @param postID Target post ID
|
||||
*/
|
||||
public static async DeleteAllPostsNotificationsTargetingUser(userID: number, postID: number) {
|
||||
await this.Delete(new Notif({
|
||||
destUserID: userID,
|
||||
onElemType: NotifElemType.POST,
|
||||
onElemID: postID
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the notification related with a post
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user