-function processVideoChannelShare (accountAnnouncer: AccountInstance, activity: ActivityAnnounce) {
- const options = {
- arguments: [ accountAnnouncer, activity ],
- errorMessage: 'Cannot share the video channel with many retries.'
- }
-
- return retryTransactionWrapper(shareVideoChannel, options)
-}
-
-async function shareVideoChannel (accountAnnouncer: AccountInstance, activity: ActivityAnnounce) {
- const announcedActivity = activity.object as ActivityCreate
-
- return db.sequelize.transaction(async t => {
- // Add share entry
- const videoChannel: VideoChannelInstance = await processCreateActivity(announcedActivity)
- const share = {
- accountId: accountAnnouncer.id,
- videoChannelId: videoChannel.id
- }
-
- const [ , created ] = await db.VideoChannelShare.findOrCreate({
- where: share,
- defaults: share,
- transaction: t
- })
-
- if (videoChannel.isOwned() && created === true) {
- // Don't resend the activity to the sender
- const exceptions = [ accountAnnouncer ]
- await forwardActivity(activity, t, exceptions)
- }
+async function processVideoShare (actorAnnouncer: MActorSignature, activity: ActivityAnnounce, notify: boolean) {
+ const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id