diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/notifier.ts | 8 | ||||
-rw-r--r-- | server/lib/video-blacklist.ts | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts index 89f91e031..3e90bb57e 100644 --- a/server/lib/notifier.ts +++ b/server/lib/notifier.ts | |||
@@ -387,7 +387,7 @@ class Notifier { | |||
387 | } | 387 | } |
388 | 388 | ||
389 | private async notifyModeratorsOfVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo) { | 389 | private async notifyModeratorsOfVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo) { |
390 | const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLACKLIST) | 390 | const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLOCKS) |
391 | if (moderators.length === 0) return | 391 | if (moderators.length === 0) return |
392 | 392 | ||
393 | logger.info('Notifying %s moderators of video auto-blacklist %s.', moderators.length, videoBlacklist.Video.url) | 393 | logger.info('Notifying %s moderators of video auto-blacklist %s.', moderators.length, videoBlacklist.Video.url) |
@@ -398,7 +398,7 @@ class Notifier { | |||
398 | 398 | ||
399 | async function notificationCreator (user: MUserWithNotificationSetting) { | 399 | async function notificationCreator (user: MUserWithNotificationSetting) { |
400 | const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ | 400 | const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ |
401 | type: UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS, | 401 | type: UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS, |
402 | userId: user.id, | 402 | userId: user.id, |
403 | videoBlacklistId: videoBlacklist.id | 403 | videoBlacklistId: videoBlacklist.id |
404 | }) | 404 | }) |
@@ -426,7 +426,7 @@ class Notifier { | |||
426 | 426 | ||
427 | async function notificationCreator (user: MUserWithNotificationSetting) { | 427 | async function notificationCreator (user: MUserWithNotificationSetting) { |
428 | const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ | 428 | const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ |
429 | type: UserNotificationType.BLACKLIST_ON_MY_VIDEO, | 429 | type: UserNotificationType.BLOCK_ON_MY_VIDEO, |
430 | userId: user.id, | 430 | userId: user.id, |
431 | videoBlacklistId: videoBlacklist.id | 431 | videoBlacklistId: videoBlacklist.id |
432 | }) | 432 | }) |
@@ -454,7 +454,7 @@ class Notifier { | |||
454 | 454 | ||
455 | async function notificationCreator (user: MUserWithNotificationSetting) { | 455 | async function notificationCreator (user: MUserWithNotificationSetting) { |
456 | const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ | 456 | const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ |
457 | type: UserNotificationType.UNBLACKLIST_ON_MY_VIDEO, | 457 | type: UserNotificationType.UNBLOCK_ON_MY_VIDEO, |
458 | userId: user.id, | 458 | userId: user.id, |
459 | videoId: video.id | 459 | videoId: video.id |
460 | }) | 460 | }) |
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts index bd60c6201..f1657e8f1 100644 --- a/server/lib/video-blacklist.ts +++ b/server/lib/video-blacklist.ts | |||
@@ -8,7 +8,7 @@ import { | |||
8 | MVideoFullLight, | 8 | MVideoFullLight, |
9 | MVideoWithBlacklistLight | 9 | MVideoWithBlacklistLight |
10 | } from '@server/typings/models' | 10 | } from '@server/typings/models' |
11 | import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models' | 11 | import { UserRight, VideoBlacklistCreate, VideoBlockType } from '../../shared/models' |
12 | import { UserAdminFlag } from '../../shared/models/users/user-flag.model' | 12 | import { UserAdminFlag } from '../../shared/models/users/user-flag.model' |
13 | import { logger } from '../helpers/logger' | 13 | import { logger } from '../helpers/logger' |
14 | import { CONFIG } from '../initializers/config' | 14 | import { CONFIG } from '../initializers/config' |
@@ -39,7 +39,7 @@ async function autoBlacklistVideoIfNeeded (parameters: { | |||
39 | videoId: video.id, | 39 | videoId: video.id, |
40 | unfederated: true, | 40 | unfederated: true, |
41 | reason: 'Auto-blacklisted. Moderator review required.', | 41 | reason: 'Auto-blacklisted. Moderator review required.', |
42 | type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED | 42 | type: VideoBlockType.AUTO_BEFORE_PUBLISHED |
43 | } | 43 | } |
44 | const [ videoBlacklist ] = await VideoBlacklistModel.findOrCreate<MVideoBlacklistVideo>({ | 44 | const [ videoBlacklist ] = await VideoBlacklistModel.findOrCreate<MVideoBlacklistVideo>({ |
45 | where: { | 45 | where: { |
@@ -64,7 +64,7 @@ async function blacklistVideo (videoInstance: MVideoAccountLight, options: Video | |||
64 | videoId: videoInstance.id, | 64 | videoId: videoInstance.id, |
65 | unfederated: options.unfederate === true, | 65 | unfederated: options.unfederate === true, |
66 | reason: options.reason, | 66 | reason: options.reason, |
67 | type: VideoBlacklistType.MANUAL | 67 | type: VideoBlockType.MANUAL |
68 | } | 68 | } |
69 | ) | 69 | ) |
70 | blacklist.Video = videoInstance | 70 | blacklist.Video = videoInstance |
@@ -94,7 +94,7 @@ async function unblacklistVideo (videoBlacklist: MVideoBlacklist, video: MVideoF | |||
94 | 94 | ||
95 | Notifier.Instance.notifyOnVideoUnblacklist(video) | 95 | Notifier.Instance.notifyOnVideoUnblacklist(video) |
96 | 96 | ||
97 | if (videoBlacklistType === VideoBlacklistType.AUTO_BEFORE_PUBLISHED) { | 97 | if (videoBlacklistType === VideoBlockType.AUTO_BEFORE_PUBLISHED) { |
98 | Notifier.Instance.notifyOnVideoPublishedAfterRemovedFromAutoBlacklist(video) | 98 | Notifier.Instance.notifyOnVideoPublishedAfterRemovedFromAutoBlacklist(video) |
99 | 99 | ||
100 | // Delete on object so new video notifications will send | 100 | // Delete on object so new video notifications will send |
@@ -126,7 +126,7 @@ function autoBlacklistNeeded (parameters: { | |||
126 | if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false | 126 | if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false |
127 | if (isRemote || isNew === false) return false | 127 | if (isRemote || isNew === false) return false |
128 | 128 | ||
129 | if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST)) return false | 129 | if (user.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK)) return false |
130 | 130 | ||
131 | return true | 131 | return true |
132 | } | 132 | } |