aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-08 11:26:41 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-01-09 11:15:15 +0100
commit2f1548fda32c3ba9e53913270394eedfacd55986 (patch)
treeafee28df36a9e00f921603d9091e5d08d5818159 /server/controllers/api/users
parentf7cc67b455a12ccae9b0ea16876d166720364357 (diff)
downloadPeerTube-2f1548fda32c3ba9e53913270394eedfacd55986.tar.gz
PeerTube-2f1548fda32c3ba9e53913270394eedfacd55986.tar.zst
PeerTube-2f1548fda32c3ba9e53913270394eedfacd55986.zip
Add notifications in the client
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}