From 3487330d308166afb542cbacae0475693c0b059e Mon Sep 17 00:00:00 2001
From: Rigel Kent <sendmemail@rigelk.eu>
Date: Tue, 9 Jun 2020 16:07:10 +0200
Subject: preserve original variable names server-side

---
 server/lib/notifier.ts        |  8 ++++----
 server/lib/video-blacklist.ts | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

(limited to 'server/lib')

diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts
index 3e90bb57e..89f91e031 100644
--- a/server/lib/notifier.ts
+++ b/server/lib/notifier.ts
@@ -387,7 +387,7 @@ class Notifier {
   }
 
   private async notifyModeratorsOfVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo) {
-    const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLOCKS)
+    const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLACKLIST)
     if (moderators.length === 0) return
 
     logger.info('Notifying %s moderators of video auto-blacklist %s.', moderators.length, videoBlacklist.Video.url)
@@ -398,7 +398,7 @@ class Notifier {
 
     async function notificationCreator (user: MUserWithNotificationSetting) {
       const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
-        type: UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS,
+        type: UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS,
         userId: user.id,
         videoBlacklistId: videoBlacklist.id
       })
@@ -426,7 +426,7 @@ class Notifier {
 
     async function notificationCreator (user: MUserWithNotificationSetting) {
       const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
-        type: UserNotificationType.BLOCK_ON_MY_VIDEO,
+        type: UserNotificationType.BLACKLIST_ON_MY_VIDEO,
         userId: user.id,
         videoBlacklistId: videoBlacklist.id
       })
@@ -454,7 +454,7 @@ class Notifier {
 
     async function notificationCreator (user: MUserWithNotificationSetting) {
       const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
-        type: UserNotificationType.UNBLOCK_ON_MY_VIDEO,
+        type: UserNotificationType.UNBLACKLIST_ON_MY_VIDEO,
         userId: user.id,
         videoId: video.id
       })
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts
index f1657e8f1..1ee92d22c 100644
--- a/server/lib/video-blacklist.ts
+++ b/server/lib/video-blacklist.ts
@@ -8,7 +8,7 @@ import {
   MVideoFullLight,
   MVideoWithBlacklistLight
 } from '@server/typings/models'
-import { UserRight, VideoBlacklistCreate, VideoBlockType } from '../../shared/models'
+import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models'
 import { UserAdminFlag } from '../../shared/models/users/user-flag.model'
 import { logger } from '../helpers/logger'
 import { CONFIG } from '../initializers/config'
@@ -39,7 +39,7 @@ async function autoBlacklistVideoIfNeeded (parameters: {
     videoId: video.id,
     unfederated: true,
     reason: 'Auto-blacklisted. Moderator review required.',
-    type: VideoBlockType.AUTO_BEFORE_PUBLISHED
+    type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
   }
   const [ videoBlacklist ] = await VideoBlacklistModel.findOrCreate<MVideoBlacklistVideo>({
     where: {
@@ -64,7 +64,7 @@ async function blacklistVideo (videoInstance: MVideoAccountLight, options: Video
     videoId: videoInstance.id,
     unfederated: options.unfederate === true,
     reason: options.reason,
-    type: VideoBlockType.MANUAL
+    type: VideoBlacklistType.MANUAL
   }
   )
   blacklist.Video = videoInstance
@@ -94,7 +94,7 @@ async function unblacklistVideo (videoBlacklist: MVideoBlacklist, video: MVideoF
 
   Notifier.Instance.notifyOnVideoUnblacklist(video)
 
-  if (videoBlacklistType === VideoBlockType.AUTO_BEFORE_PUBLISHED) {
+  if (videoBlacklistType === VideoBlacklistType.AUTO_BEFORE_PUBLISHED) {
     Notifier.Instance.notifyOnVideoPublishedAfterRemovedFromAutoBlacklist(video)
 
     // Delete on object so new video notifications will send
@@ -126,7 +126,7 @@ function autoBlacklistNeeded (parameters: {
   if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false
   if (isRemote || isNew === false) return false
 
-  if (user.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK)) return false
+  if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST)) return false
 
   return true
 }
-- 
cgit v1.2.3