aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/my-notifications.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index d74d26add..76cf97587 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -45,6 +45,11 @@ myNotificationsRouter.post('/me/notifications/read',
45 asyncMiddleware(markAsReadUserNotifications) 45 asyncMiddleware(markAsReadUserNotifications)
46) 46)
47 47
48myNotificationsRouter.post('/me/notifications/read-all',
49 authenticate,
50 asyncMiddleware(markAsReadAllUserNotifications)
51)
52
48export { 53export {
49 myNotificationsRouter 54 myNotificationsRouter
50} 55}
@@ -70,7 +75,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
70 myVideoImportFinished: body.myVideoImportFinished, 75 myVideoImportFinished: body.myVideoImportFinished,
71 newFollow: body.newFollow, 76 newFollow: body.newFollow,
72 newUserRegistration: body.newUserRegistration, 77 newUserRegistration: body.newUserRegistration,
73 commentMention: body.commentMention, 78 commentMention: body.commentMention
74 } 79 }
75 80
76 await UserNotificationSettingModel.update(values, query) 81 await UserNotificationSettingModel.update(values, query)
@@ -93,3 +98,11 @@ async function markAsReadUserNotifications (req: express.Request, res: express.R
93 98
94 return res.status(204).end() 99 return res.status(204).end()
95} 100}
101
102async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) {
103 const user: UserModel = res.locals.oauth.token.User
104
105 await UserNotificationModel.markAllAsRead(user.id)
106
107 return res.status(204).end()
108}