import { VideoModel } from '../../../models/video/video'
import { VideoShareModel } from '../../../models/video/video-share'
import { getOrCreateActorAndServerAndModel } from '../actor'
-import { forwardActivity } from '../send/utils'
+import { forwardVideoRelatedActivity } from '../send/utils'
import { getOrCreateAccountAndVideoAndChannel } from '../videos'
async function processAnnounceActivity (activity: ActivityAnnounce) {
if (video.isOwned() && created === true) {
// Don't resend the activity to the sender
const exceptions = [ actorAnnouncer ]
- await forwardActivity(activity, t, exceptions)
+
+ await forwardVideoRelatedActivity(activity, t, exceptions, video)
}
return undefined
import { VideoAbuseModel } from '../../../models/video/video-abuse'
import { VideoCommentModel } from '../../../models/video/video-comment'
import { getOrCreateActorAndServerAndModel } from '../actor'
-import { getActorsInvolvedInVideo } from '../audience'
import { resolveThread } from '../video-comments'
import { getOrCreateAccountAndVideoAndChannel } from '../videos'
-import { forwardActivity } from '../send/utils'
+import { forwardActivity, forwardVideoRelatedActivity } from '../send/utils'
async function processCreateActivity (activity: ActivityCreate) {
const activityObject = activity.object
if (video.isOwned() && created === true) {
// Don't resend the activity to the sender
const exceptions = [ byActor ]
- await forwardActivity(activity, t, exceptions)
+
+ await forwardVideoRelatedActivity(activity, t, exceptions, video)
}
})
}
// Don't resend the activity to the sender
const exceptions = [ byActor ]
- // Mastodon does not add our announces in audience, so we forward to them manually
- const additionalActors = await getActorsInvolvedInVideo(video, t)
- const additionalFollowerUrls = additionalActors.map(a => a.followersUrl)
-
- await forwardActivity(activity, t, exceptions, additionalFollowerUrls)
+ await forwardVideoRelatedActivity(activity, t, exceptions, video)
}
})
}
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { ActorModel } from '../../../models/activitypub/actor'
import { getOrCreateActorAndServerAndModel } from '../actor'
-import { forwardActivity } from '../send/utils'
+import { forwardActivity, forwardVideoRelatedActivity } from '../send/utils'
import { getOrCreateAccountAndVideoAndChannel } from '../videos'
+import { getActorsInvolvedInVideo } from '../audience'
async function processLikeActivity (activity: ActivityLike) {
const actor = await getOrCreateActorAndServerAndModel(activity.actor)
if (video.isOwned() && created === true) {
// Don't resend the activity to the sender
const exceptions = [ byActor ]
- await forwardActivity(activity, t, exceptions)
+
+ await forwardVideoRelatedActivity(activity, t, exceptions, video)
}
})
}
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { ActorModel } from '../../../models/activitypub/actor'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { forwardActivity } from '../send/utils'
+import { forwardVideoRelatedActivity } from '../send/utils'
import { getOrCreateAccountAndVideoAndChannel } from '../videos'
import { VideoShareModel } from '../../../models/video/video-share'
if (video.isOwned()) {
// Don't resend the activity to the sender
const exceptions = [ byAccount.Actor ]
- await forwardActivity(activity, t, exceptions)
+
+ await forwardVideoRelatedActivity(activity, t, exceptions, video)
}
})
}
if (video.isOwned()) {
// Don't resend the activity to the sender
const exceptions = [ byAccount.Actor ]
- await forwardActivity(activity, t, exceptions)
+
+ await forwardVideoRelatedActivity(activity, t, exceptions, video)
}
})
}
function undoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) {
return sequelizeTypescript.transaction(async t => {
+ const byAccount = await AccountModel.loadByUrl(actorUrl, t)
+ if (!byAccount) throw new Error('Unknown account ' + actorUrl)
+
const share = await VideoShareModel.loadByUrl(announceActivity.id, t)
if (!share) throw new Error(`'Unknown video share ${announceActivity.id}.`)
await share.destroy({ transaction: t })
- return undefined
+ if (share.Video.isOwned()) {
+ // Don't resend the activity to the sender
+ const exceptions = [ byAccount.Actor ]
+
+ await forwardVideoRelatedActivity(announceActivity, t, exceptions, share.Video)
+ }
})
}
import { ActorModel } from '../../../models/activitypub/actor'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { JobQueue } from '../../job-queue'
+import { VideoModel } from '../../../models/video/video'
+import { getActorsInvolvedInVideo } from '../audience'
+
+async function forwardVideoRelatedActivity (
+ activity: Activity,
+ t: Transaction,
+ followersException: ActorModel[] = [],
+ video: VideoModel
+) {
+ // Mastodon does not add our announces in audience, so we forward to them manually
+ const additionalActors = await getActorsInvolvedInVideo(video, t)
+ const additionalFollowerUrls = additionalActors.map(a => a.followersUrl)
+
+ return forwardActivity(activity, t, followersException, additionalFollowerUrls)
+}
async function forwardActivity (
activity: Activity,
broadcastToFollowers,
unicastTo,
forwardActivity,
- broadcastToActors
+ broadcastToActors,
+ forwardVideoRelatedActivity
}
// ---------------------------------------------------------------------------
}
static loadByUrl (url: string, t: Sequelize.Transaction) {
- return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({
+ return VideoShareModel.scope(ScopeNames.FULL).findOne({
where: {
url
},