diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-15 17:56:21 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | d846501818c2d29e66e6fd141789cb04fd55a437 (patch) | |
tree | 9b807a84459edd400fd36325c49c4adfbd6c4fd2 /server/lib/activitypub/process-create.ts | |
parent | 8e10cf1a5a438a00e5f7e0691cb830769867cffc (diff) | |
download | PeerTube-d846501818c2d29e66e6fd141789cb04fd55a437.tar.gz PeerTube-d846501818c2d29e66e6fd141789cb04fd55a437.tar.zst PeerTube-d846501818c2d29e66e6fd141789cb04fd55a437.zip |
Handle announces in inbox
Diffstat (limited to 'server/lib/activitypub/process-create.ts')
-rw-r--r-- | server/lib/activitypub/process-create.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/lib/activitypub/process-create.ts b/server/lib/activitypub/process-create.ts index 8d842b822..1b825ebbc 100644 --- a/server/lib/activitypub/process-create.ts +++ b/server/lib/activitypub/process-create.ts | |||
@@ -40,7 +40,7 @@ function processCreateVideoChannel (account: AccountInstance, videoChannelToCrea | |||
40 | async function addRemoteVideoChannel (account: AccountInstance, videoChannelToCreateData: VideoChannelObject) { | 40 | async function addRemoteVideoChannel (account: AccountInstance, videoChannelToCreateData: VideoChannelObject) { |
41 | logger.debug('Adding remote video channel "%s".', videoChannelToCreateData.uuid) | 41 | logger.debug('Adding remote video channel "%s".', videoChannelToCreateData.uuid) |
42 | 42 | ||
43 | await db.sequelize.transaction(async t => { | 43 | return db.sequelize.transaction(async t => { |
44 | let videoChannel = await db.VideoChannel.loadByUUIDOrUrl(videoChannelToCreateData.uuid, videoChannelToCreateData.id, t) | 44 | let videoChannel = await db.VideoChannel.loadByUUIDOrUrl(videoChannelToCreateData.uuid, videoChannelToCreateData.id, t) |
45 | if (videoChannel) throw new Error('Video channel with this URL/UUID already exists.') | 45 | if (videoChannel) throw new Error('Video channel with this URL/UUID already exists.') |
46 | 46 | ||
@@ -57,10 +57,11 @@ async function addRemoteVideoChannel (account: AccountInstance, videoChannelToCr | |||
57 | videoChannel = db.VideoChannel.build(videoChannelData) | 57 | videoChannel = db.VideoChannel.build(videoChannelData) |
58 | videoChannel.url = getActivityPubUrl('videoChannel', videoChannel.uuid) | 58 | videoChannel.url = getActivityPubUrl('videoChannel', videoChannel.uuid) |
59 | 59 | ||
60 | await videoChannel.save({ transaction: t }) | 60 | videoChannel = await videoChannel.save({ transaction: t }) |
61 | }) | 61 | logger.info('Remote video channel with uuid %s inserted.', videoChannelToCreateData.uuid) |
62 | 62 | ||
63 | logger.info('Remote video channel with uuid %s inserted.', videoChannelToCreateData.uuid) | 63 | return videoChannel |
64 | }) | ||
64 | } | 65 | } |
65 | 66 | ||
66 | function processCreateVideoAbuse (account: AccountInstance, videoAbuseToCreateData: VideoAbuseObject) { | 67 | function processCreateVideoAbuse (account: AccountInstance, videoAbuseToCreateData: VideoAbuseObject) { |