1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add new follow, mention and user registered notifs

This commit is contained in:
Chocobozzz 2019-01-04 08:56:20 +01:00 committed by Chocobozzz
parent dc13348070
commit f7cc67b455
25 changed files with 899 additions and 57 deletions

View file

@ -18,7 +18,7 @@ import {
markAsReadUserNotificationsValidator,
updateNotificationSettingsValidator
} from '../../../middlewares/validators/user-notifications'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../../../shared/models/users'
import { UserNotificationSetting } from '../../../../shared/models/users'
import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting'
const myNotificationsRouter = express.Router()
@ -53,7 +53,7 @@ export {
async function updateNotificationSettings (req: express.Request, res: express.Response) {
const user: UserModel = res.locals.oauth.token.User
const body: UserNotificationSetting = req.body
const body = req.body
const query = {
where: {
@ -61,14 +61,19 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
}
}
await UserNotificationSettingModel.update({
const values: UserNotificationSetting = {
newVideoFromSubscription: body.newVideoFromSubscription,
newCommentOnMyVideo: body.newCommentOnMyVideo,
videoAbuseAsModerator: body.videoAbuseAsModerator,
blacklistOnMyVideo: body.blacklistOnMyVideo,
myVideoPublished: body.myVideoPublished,
myVideoImportFinished: body.myVideoImportFinished
}, query)
myVideoImportFinished: body.myVideoImportFinished,
newFollow: body.newFollow,
newUserRegistration: body.newUserRegistration,
commentMention: body.commentMention,
}
await UserNotificationSettingModel.update(values, query)
return res.status(204).end()
}