From 5baee5fca418487e72ddcd6419d31bca8659b668 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 2 Jun 2020 20:50:42 +0200 Subject: rename blacklist to block/blocklist, merge block and auto-block views - also replace whitelist with allowlist - add advanced filters for video-block-list view - move icons in video-block-list and video-abuse-list to left side for visibility - add robot icon to depict automated nature of a block in video-block-list resolves #2790 --- 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 89f91e031..3e90bb57e 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_BLACKLIST) + const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLOCKS) 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({ - type: UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS, + type: UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS, userId: user.id, videoBlacklistId: videoBlacklist.id }) @@ -426,7 +426,7 @@ class Notifier { async function notificationCreator (user: MUserWithNotificationSetting) { const notification = await UserNotificationModel.create({ - type: UserNotificationType.BLACKLIST_ON_MY_VIDEO, + type: UserNotificationType.BLOCK_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({ - type: UserNotificationType.UNBLACKLIST_ON_MY_VIDEO, + type: UserNotificationType.UNBLOCK_ON_MY_VIDEO, userId: user.id, videoId: video.id }) 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 { MVideoFullLight, MVideoWithBlacklistLight } from '@server/typings/models' -import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models' +import { UserRight, VideoBlacklistCreate, VideoBlockType } 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: VideoBlacklistType.AUTO_BEFORE_PUBLISHED + type: VideoBlockType.AUTO_BEFORE_PUBLISHED } const [ videoBlacklist ] = await VideoBlacklistModel.findOrCreate({ where: { @@ -64,7 +64,7 @@ async function blacklistVideo (videoInstance: MVideoAccountLight, options: Video videoId: videoInstance.id, unfederated: options.unfederate === true, reason: options.reason, - type: VideoBlacklistType.MANUAL + type: VideoBlockType.MANUAL } ) blacklist.Video = videoInstance @@ -94,7 +94,7 @@ async function unblacklistVideo (videoBlacklist: MVideoBlacklist, video: MVideoF Notifier.Instance.notifyOnVideoUnblacklist(video) - if (videoBlacklistType === VideoBlacklistType.AUTO_BEFORE_PUBLISHED) { + if (videoBlacklistType === VideoBlockType.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_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST)) return false + if (user.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK)) return false return true } -- cgit v1.2.3