- const object = await followActivityData(followUrl, me, following)
- const data = await undoActivityData(undoUrl, me, object)
+ const followActivity = buildFollowActivity(followUrl, me, following)
+ const undoActivity = undoActivityData(undoUrl, me, followActivity)
+
+ t.afterCommit(() => unicastTo(undoActivity, me, following.inboxUrl))
+}
+
+async function sendUndoAnnounce (byActor: MActorLight, videoShare: MVideoShare, video: MVideo, t: Transaction) {
+ logger.info('Creating job to undo announce %s.', videoShare.url)
+
+ const undoUrl = getUndoActivityPubUrl(videoShare.url)
+
+ const { activity: announceActivity, actorsInvolvedInVideo } = await buildAnnounceWithVideoAudience(byActor, videoShare, video, t)
+ const undoActivity = undoActivityData(undoUrl, byActor, announceActivity)
+
+ const followersException = [ byActor ]
+ return broadcastToFollowers(undoActivity, byActor, actorsInvolvedInVideo, t, followersException)
+}
+
+async function sendUndoLike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {
+ logger.info('Creating job to undo a like of video %s.', video.url)
+
+ const likeUrl = getVideoLikeActivityPubUrl(byActor, video)
+ const likeActivity = buildLikeActivity(likeUrl, byActor, video)