diff options
Diffstat (limited to 'server/lib/video-blacklist.ts')
-rw-r--r-- | server/lib/video-blacklist.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts index cb1ea834c..d5664a1b9 100644 --- a/server/lib/video-blacklist.ts +++ b/server/lib/video-blacklist.ts | |||
@@ -27,13 +27,14 @@ async function autoBlacklistVideoIfNeeded (parameters: { | |||
27 | user?: MUser | 27 | user?: MUser |
28 | isRemote: boolean | 28 | isRemote: boolean |
29 | isNew: boolean | 29 | isNew: boolean |
30 | isNewFile: boolean | ||
30 | notify?: boolean | 31 | notify?: boolean |
31 | transaction?: Transaction | 32 | transaction?: Transaction |
32 | }) { | 33 | }) { |
33 | const { video, user, isRemote, isNew, notify = true, transaction } = parameters | 34 | const { video, user, isRemote, isNew, isNewFile, notify = true, transaction } = parameters |
34 | const doAutoBlacklist = await Hooks.wrapFun( | 35 | const doAutoBlacklist = await Hooks.wrapFun( |
35 | autoBlacklistNeeded, | 36 | autoBlacklistNeeded, |
36 | { video, user, isRemote, isNew }, | 37 | { video, user, isRemote, isNew, isNewFile }, |
37 | 'filter:video.auto-blacklist.result' | 38 | 'filter:video.auto-blacklist.result' |
38 | ) | 39 | ) |
39 | 40 | ||
@@ -128,14 +129,15 @@ function autoBlacklistNeeded (parameters: { | |||
128 | video: MVideoWithBlacklistLight | 129 | video: MVideoWithBlacklistLight |
129 | isRemote: boolean | 130 | isRemote: boolean |
130 | isNew: boolean | 131 | isNew: boolean |
132 | isNewFile: boolean | ||
131 | user?: MUser | 133 | user?: MUser |
132 | }) { | 134 | }) { |
133 | const { user, video, isRemote, isNew } = parameters | 135 | const { user, video, isRemote, isNew, isNewFile } = parameters |
134 | 136 | ||
135 | // Already blacklisted | 137 | // Already blacklisted |
136 | if (video.VideoBlacklist) return false | 138 | if (video.VideoBlacklist) return false |
137 | if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false | 139 | if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false |
138 | if (isRemote || isNew === false) return false | 140 | if (isRemote || (isNew === false && isNewFile === false)) return false |
139 | 141 | ||
140 | if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST)) return false | 142 | if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST)) return false |
141 | 143 | ||