diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-28 13:47:17 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-01-09 11:15:15 +0100 |
commit | e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241 (patch) | |
tree | c0986e91e6ed466af075ddac3c795894db4d0b85 /server/lib/activitypub | |
parent | cef534ed53e4518fe0acf581bfe880788d42fc36 (diff) | |
download | PeerTube-e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241.tar.gz PeerTube-e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241.tar.zst PeerTube-e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241.zip |
Add notification settings migration
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/videos.ts | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 5794988a5..893768769 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -204,19 +204,17 @@ async function updateVideoFromAP (options: { | |||
204 | overrideTo?: string[] | 204 | overrideTo?: string[] |
205 | }) { | 205 | }) { |
206 | logger.debug('Updating remote video "%s".', options.videoObject.uuid) | 206 | logger.debug('Updating remote video "%s".', options.videoObject.uuid) |
207 | |||
207 | let videoFieldsSave: any | 208 | let videoFieldsSave: any |
209 | const wasPrivateVideo = options.video.privacy === VideoPrivacy.PRIVATE | ||
210 | const wasUnlistedVideo = options.video.privacy === VideoPrivacy.UNLISTED | ||
208 | 211 | ||
209 | try { | 212 | try { |
210 | await sequelizeTypescript.transaction(async t => { | 213 | await sequelizeTypescript.transaction(async t => { |
211 | const sequelizeOptions = { | 214 | const sequelizeOptions = { transaction: t } |
212 | transaction: t | ||
213 | } | ||
214 | 215 | ||
215 | videoFieldsSave = options.video.toJSON() | 216 | videoFieldsSave = options.video.toJSON() |
216 | 217 | ||
217 | const wasPrivateVideo = options.video.privacy === VideoPrivacy.PRIVATE | ||
218 | const wasUnlistedVideo = options.video.privacy === VideoPrivacy.UNLISTED | ||
219 | |||
220 | // Check actor has the right to update the video | 218 | // Check actor has the right to update the video |
221 | const videoChannel = options.video.VideoChannel | 219 | const videoChannel = options.video.VideoChannel |
222 | if (videoChannel.Account.id !== options.account.id) { | 220 | if (videoChannel.Account.id !== options.account.id) { |
@@ -281,15 +279,13 @@ async function updateVideoFromAP (options: { | |||
281 | }) | 279 | }) |
282 | options.video.VideoCaptions = await Promise.all(videoCaptionsPromises) | 280 | options.video.VideoCaptions = await Promise.all(videoCaptionsPromises) |
283 | } | 281 | } |
284 | |||
285 | { | ||
286 | // Notify our users? | ||
287 | if (wasPrivateVideo || wasUnlistedVideo) { | ||
288 | Notifier.Instance.notifyOnNewVideo(options.video) | ||
289 | } | ||
290 | } | ||
291 | }) | 282 | }) |
292 | 283 | ||
284 | // Notify our users? | ||
285 | if (wasPrivateVideo || wasUnlistedVideo) { | ||
286 | Notifier.Instance.notifyOnNewVideo(options.video) | ||
287 | } | ||
288 | |||
293 | logger.info('Remote video with uuid %s updated', options.videoObject.uuid) | 289 | logger.info('Remote video with uuid %s updated', options.videoObject.uuid) |
294 | } catch (err) { | 290 | } catch (err) { |
295 | if (options.video !== undefined && videoFieldsSave !== undefined) { | 291 | if (options.video !== undefined && videoFieldsSave !== undefined) { |