diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 11e468df2..6a79a16c7 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -268,7 +268,13 @@ async function addVideo (req: express.Request, res: express.Response) { | |||
268 | }, { transaction: t }) | 268 | }, { transaction: t }) |
269 | } | 269 | } |
270 | 270 | ||
271 | const videoWasAutoBlacklisted = await autoBlacklistVideoIfNeeded(video, res.locals.oauth.token.User, t) | 271 | const videoWasAutoBlacklisted = await autoBlacklistVideoIfNeeded({ |
272 | video, | ||
273 | user: res.locals.oauth.token.User, | ||
274 | isRemote: false, | ||
275 | isNew: true, | ||
276 | transaction: t | ||
277 | }) | ||
272 | if (!videoWasAutoBlacklisted) await federateVideoIfNeeded(video, true, t) | 278 | if (!videoWasAutoBlacklisted) await federateVideoIfNeeded(video, true, t) |
273 | 279 | ||
274 | auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(videoCreated.toFormattedDetailsJSON())) | 280 | auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(videoCreated.toFormattedDetailsJSON())) |
@@ -336,16 +342,16 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
336 | const sequelizeOptions = { transaction: t } | 342 | const sequelizeOptions = { transaction: t } |
337 | const oldVideoChannel = videoInstance.VideoChannel | 343 | const oldVideoChannel = videoInstance.VideoChannel |
338 | 344 | ||
339 | if (videoInfoToUpdate.name !== undefined) videoInstance.set('name', videoInfoToUpdate.name) | 345 | if (videoInfoToUpdate.name !== undefined) videoInstance.name = videoInfoToUpdate.name |
340 | if (videoInfoToUpdate.category !== undefined) videoInstance.set('category', videoInfoToUpdate.category) | 346 | if (videoInfoToUpdate.category !== undefined) videoInstance.category = videoInfoToUpdate.category |
341 | if (videoInfoToUpdate.licence !== undefined) videoInstance.set('licence', videoInfoToUpdate.licence) | 347 | if (videoInfoToUpdate.licence !== undefined) videoInstance.licence = videoInfoToUpdate.licence |
342 | if (videoInfoToUpdate.language !== undefined) videoInstance.set('language', videoInfoToUpdate.language) | 348 | if (videoInfoToUpdate.language !== undefined) videoInstance.language = videoInfoToUpdate.language |
343 | if (videoInfoToUpdate.nsfw !== undefined) videoInstance.set('nsfw', videoInfoToUpdate.nsfw) | 349 | if (videoInfoToUpdate.nsfw !== undefined) videoInstance.nsfw = videoInfoToUpdate.nsfw |
344 | if (videoInfoToUpdate.waitTranscoding !== undefined) videoInstance.set('waitTranscoding', videoInfoToUpdate.waitTranscoding) | 350 | if (videoInfoToUpdate.waitTranscoding !== undefined) videoInstance.waitTranscoding = videoInfoToUpdate.waitTranscoding |
345 | if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support) | 351 | if (videoInfoToUpdate.support !== undefined) videoInstance.support = videoInfoToUpdate.support |
346 | if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description) | 352 | if (videoInfoToUpdate.description !== undefined) videoInstance.description = videoInfoToUpdate.description |
347 | if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled) | 353 | if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.commentsEnabled = videoInfoToUpdate.commentsEnabled |
348 | if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.set('downloadEnabled', videoInfoToUpdate.downloadEnabled) | 354 | if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.downloadEnabled = videoInfoToUpdate.downloadEnabled |
349 | 355 | ||
350 | if (videoInfoToUpdate.originallyPublishedAt !== undefined && videoInfoToUpdate.originallyPublishedAt !== null) { | 356 | if (videoInfoToUpdate.originallyPublishedAt !== undefined && videoInfoToUpdate.originallyPublishedAt !== null) { |
351 | videoInstance.originallyPublishedAt = new Date(videoInfoToUpdate.originallyPublishedAt) | 357 | videoInstance.originallyPublishedAt = new Date(videoInfoToUpdate.originallyPublishedAt) |
@@ -398,6 +404,14 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
398 | await ScheduleVideoUpdateModel.deleteByVideoId(videoInstanceUpdated.id, t) | 404 | await ScheduleVideoUpdateModel.deleteByVideoId(videoInstanceUpdated.id, t) |
399 | } | 405 | } |
400 | 406 | ||
407 | await autoBlacklistVideoIfNeeded({ | ||
408 | video: videoInstanceUpdated, | ||
409 | user: res.locals.oauth.token.User, | ||
410 | isRemote: false, | ||
411 | isNew: false, | ||
412 | transaction: t | ||
413 | }) | ||
414 | |||
401 | const isNewVideo = wasPrivateVideo && videoInstanceUpdated.privacy !== VideoPrivacy.PRIVATE | 415 | const isNewVideo = wasPrivateVideo && videoInstanceUpdated.privacy !== VideoPrivacy.PRIVATE |
402 | 416 | ||
403 | // Don't send update if the video was unfederated | 417 | // Don't send update if the video was unfederated |