From 5e3bb76cb6cc17ff2ba5a492ea3ed8358e66a00a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Nov 2017 08:45:03 +0100 Subject: Fix undo like/dislike forwarding --- server/lib/activitypub/send/send-undo.ts | 17 ++++++++++++++--- server/tests/api/video-transcoder.ts | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index 9b732df40..878acd21e 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts @@ -10,7 +10,14 @@ import { AccountInstance } from '../../../models' import { AccountFollowInstance } from '../../../models/account/account-follow-interface' import { VideoInstance } from '../../../models/video/video-interface' import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' -import { broadcastToFollowers, getAccountsInvolvedInVideo, getAudience, getObjectFollowersAudience, unicastTo } from './misc' +import { + broadcastToFollowers, + getAccountsInvolvedInVideo, + getAudience, + getObjectFollowersAudience, + getOriginVideoAudience, + unicastTo +} from './misc' import { createActivityData, createDislikeActivityData } from './send-create' import { followActivityData } from './send-follow' import { likeActivityData } from './send-like' @@ -32,8 +39,10 @@ async function sendUndoLikeToOrigin (byAccount: AccountInstance, video: VideoIns const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) const undoUrl = getUndoActivityPubUrl(likeUrl) + const accountsInvolvedInVideo = await getAccountsInvolvedInVideo(video) + const audience = getOriginVideoAudience(video, accountsInvolvedInVideo) const object = await likeActivityData(likeUrl, byAccount, video) - const data = await undoActivityData(undoUrl, byAccount, object) + const data = await undoActivityData(undoUrl, byAccount, object, audience) return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) } @@ -55,8 +64,10 @@ async function sendUndoDislikeToOrigin (byAccount: AccountInstance, video: Video const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) const undoUrl = getUndoActivityPubUrl(dislikeUrl) + const accountsInvolvedInVideo = await getAccountsInvolvedInVideo(video) + const audience = getOriginVideoAudience(video, accountsInvolvedInVideo) const dislikeActivity = createDislikeActivityData(byAccount, video) - const object = await createActivityData(undoUrl, byAccount, dislikeActivity) + const object = await createActivityData(undoUrl, byAccount, dislikeActivity, audience) const data = await undoActivityData(undoUrl, byAccount, object) diff --git a/server/tests/api/video-transcoder.ts b/server/tests/api/video-transcoder.ts index 95d48342f..9a6e91b76 100644 --- a/server/tests/api/video-transcoder.ts +++ b/server/tests/api/video-transcoder.ts @@ -67,7 +67,7 @@ describe('Test video transcoding', function () { } await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) - await wait(10000) + await wait(20000) const res = await getVideosList(servers[1].url) -- cgit v1.2.3