aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/my-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-04 08:56:20 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-01-09 11:15:15 +0100
commitf7cc67b455a12ccae9b0ea16876d166720364357 (patch)
treeeac2cdbf2e92a16b3eda5d74371c82bd79ae22cb /server/controllers/api/users/my-notifications.ts
parentdc13348070d808d0ba3feb56a435b835c2e7e791 (diff)
downloadPeerTube-f7cc67b455a12ccae9b0ea16876d166720364357.tar.gz
PeerTube-f7cc67b455a12ccae9b0ea16876d166720364357.tar.zst
PeerTube-f7cc67b455a12ccae9b0ea16876d166720364357.zip
Add new follow, mention and user registered notifs
Diffstat (limited to 'server/controllers/api/users/my-notifications.ts')
-rw-r--r--server/controllers/api/users/my-notifications.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index 4b81777a4..d74d26add 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -18,7 +18,7 @@ import {
18 markAsReadUserNotificationsValidator, 18 markAsReadUserNotificationsValidator,
19 updateNotificationSettingsValidator 19 updateNotificationSettingsValidator
20} from '../../../middlewares/validators/user-notifications' 20} from '../../../middlewares/validators/user-notifications'
21import { UserNotificationSetting, UserNotificationSettingValue } from '../../../../shared/models/users' 21import { UserNotificationSetting } from '../../../../shared/models/users'
22import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting' 22import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting'
23 23
24const myNotificationsRouter = express.Router() 24const myNotificationsRouter = express.Router()
@@ -53,7 +53,7 @@ export {
53 53
54async function updateNotificationSettings (req: express.Request, res: express.Response) { 54async function updateNotificationSettings (req: express.Request, res: express.Response) {
55 const user: UserModel = res.locals.oauth.token.User 55 const user: UserModel = res.locals.oauth.token.User
56 const body: UserNotificationSetting = req.body 56 const body = req.body
57 57
58 const query = { 58 const query = {
59 where: { 59 where: {
@@ -61,14 +61,19 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
61 } 61 }
62 } 62 }
63 63
64 await UserNotificationSettingModel.update({ 64 const values: UserNotificationSetting = {
65 newVideoFromSubscription: body.newVideoFromSubscription, 65 newVideoFromSubscription: body.newVideoFromSubscription,
66 newCommentOnMyVideo: body.newCommentOnMyVideo, 66 newCommentOnMyVideo: body.newCommentOnMyVideo,
67 videoAbuseAsModerator: body.videoAbuseAsModerator, 67 videoAbuseAsModerator: body.videoAbuseAsModerator,
68 blacklistOnMyVideo: body.blacklistOnMyVideo, 68 blacklistOnMyVideo: body.blacklistOnMyVideo,
69 myVideoPublished: body.myVideoPublished, 69 myVideoPublished: body.myVideoPublished,
70 myVideoImportFinished: body.myVideoImportFinished 70 myVideoImportFinished: body.myVideoImportFinished,
71 }, query) 71 newFollow: body.newFollow,
72 newUserRegistration: body.newUserRegistration,
73 commentMention: body.commentMention,
74 }
75
76 await UserNotificationSettingModel.update(values, query)
72 77
73 return res.status(204).end() 78 return res.status(204).end()
74} 79}