X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fusers%2Fmy-notifications.ts;h=3beee07c021634d3c773098b52a7450e9ca71ef6;hb=171efc48e67498406feb6d7873b3482b41505515;hp=017f5219edeb5a3b65bf6bbe855243d7d35aaefb;hpb=8424c4026afd7304880a4ce8138a04ffb3d8c938;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts index 017f5219e..3beee07c0 100644 --- a/server/controllers/api/users/my-notifications.ts +++ b/server/controllers/api/users/my-notifications.ts @@ -1,5 +1,9 @@ -import * as express from 'express' import 'multer' +import * as express from 'express' +import { UserNotificationModel } from '@server/models/user/user-notification' +import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { UserNotificationSetting } from '../../../../shared/models/users' +import { getFormattedObjects } from '../../../helpers/utils' import { asyncMiddleware, asyncRetryTransactionMiddleware, @@ -9,16 +13,13 @@ import { setDefaultSort, userNotificationsSortValidator } from '../../../middlewares' -import { getFormattedObjects } from '../../../helpers/utils' -import { UserNotificationModel } from '../../../models/account/user-notification' -import { meRouter } from './me' import { listUserNotificationsValidator, markAsReadUserNotificationsValidator, updateNotificationSettingsValidator } from '../../../middlewares/validators/user-notifications' -import { UserNotificationSetting } from '../../../../shared/models/users' -import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting' +import { UserNotificationSettingModel } from '../../../models/user/user-notification-setting' +import { meRouter } from './me' const myNotificationsRouter = express.Router() @@ -68,7 +69,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re const values: UserNotificationSetting = { newVideoFromSubscription: body.newVideoFromSubscription, newCommentOnMyVideo: body.newCommentOnMyVideo, - videoAbuseAsModerator: body.videoAbuseAsModerator, + abuseAsModerator: body.abuseAsModerator, videoAutoBlacklistAsModerator: body.videoAutoBlacklistAsModerator, blacklistOnMyVideo: body.blacklistOnMyVideo, myVideoPublished: body.myVideoPublished, @@ -77,12 +78,16 @@ async function updateNotificationSettings (req: express.Request, res: express.Re newUserRegistration: body.newUserRegistration, commentMention: body.commentMention, newInstanceFollower: body.newInstanceFollower, - autoInstanceFollowing: body.autoInstanceFollowing + autoInstanceFollowing: body.autoInstanceFollowing, + abuseNewMessage: body.abuseNewMessage, + abuseStateChange: body.abuseStateChange, + newPeerTubeVersion: body.newPeerTubeVersion, + newPluginVersion: body.newPluginVersion } await UserNotificationSettingModel.update(values, query) - return res.status(204).end() + return res.status(HttpStatusCode.NO_CONTENT_204).end() } async function listUserNotifications (req: express.Request, res: express.Response) { @@ -98,7 +103,7 @@ async function markAsReadUserNotifications (req: express.Request, res: express.R await UserNotificationModel.markAsRead(user.id, req.body.ids) - return res.status(204).end() + return res.status(HttpStatusCode.NO_CONTENT_204).end() } async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) { @@ -106,5 +111,5 @@ async function markAsReadAllUserNotifications (req: express.Request, res: expres await UserNotificationModel.markAllAsRead(user.id) - return res.status(204).end() + return res.status(HttpStatusCode.NO_CONTENT_204).end() }