diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-28 08:45:03 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-28 08:45:03 +0100 |
commit | 5e3bb76cb6cc17ff2ba5a492ea3ed8358e66a00a (patch) | |
tree | 241054396eddeae9f7a52e2551622112a5d2e85c /server | |
parent | a2431b7dcbc72c05101dcdbe631ff84a823aeb51 (diff) | |
download | PeerTube-5e3bb76cb6cc17ff2ba5a492ea3ed8358e66a00a.tar.gz PeerTube-5e3bb76cb6cc17ff2ba5a492ea3ed8358e66a00a.tar.zst PeerTube-5e3bb76cb6cc17ff2ba5a492ea3ed8358e66a00a.zip |
Fix undo like/dislike forwarding
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/activitypub/send/send-undo.ts | 17 | ||||
-rw-r--r-- | 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' | |||
10 | import { AccountFollowInstance } from '../../../models/account/account-follow-interface' | 10 | import { AccountFollowInstance } from '../../../models/account/account-follow-interface' |
11 | import { VideoInstance } from '../../../models/video/video-interface' | 11 | import { VideoInstance } from '../../../models/video/video-interface' |
12 | import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' | 12 | import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' |
13 | import { broadcastToFollowers, getAccountsInvolvedInVideo, getAudience, getObjectFollowersAudience, unicastTo } from './misc' | 13 | import { |
14 | broadcastToFollowers, | ||
15 | getAccountsInvolvedInVideo, | ||
16 | getAudience, | ||
17 | getObjectFollowersAudience, | ||
18 | getOriginVideoAudience, | ||
19 | unicastTo | ||
20 | } from './misc' | ||
14 | import { createActivityData, createDislikeActivityData } from './send-create' | 21 | import { createActivityData, createDislikeActivityData } from './send-create' |
15 | import { followActivityData } from './send-follow' | 22 | import { followActivityData } from './send-follow' |
16 | import { likeActivityData } from './send-like' | 23 | import { likeActivityData } from './send-like' |
@@ -32,8 +39,10 @@ async function sendUndoLikeToOrigin (byAccount: AccountInstance, video: VideoIns | |||
32 | const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) | 39 | const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) |
33 | const undoUrl = getUndoActivityPubUrl(likeUrl) | 40 | const undoUrl = getUndoActivityPubUrl(likeUrl) |
34 | 41 | ||
42 | const accountsInvolvedInVideo = await getAccountsInvolvedInVideo(video) | ||
43 | const audience = getOriginVideoAudience(video, accountsInvolvedInVideo) | ||
35 | const object = await likeActivityData(likeUrl, byAccount, video) | 44 | const object = await likeActivityData(likeUrl, byAccount, video) |
36 | const data = await undoActivityData(undoUrl, byAccount, object) | 45 | const data = await undoActivityData(undoUrl, byAccount, object, audience) |
37 | 46 | ||
38 | return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) | 47 | return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) |
39 | } | 48 | } |
@@ -55,8 +64,10 @@ async function sendUndoDislikeToOrigin (byAccount: AccountInstance, video: Video | |||
55 | const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) | 64 | const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) |
56 | const undoUrl = getUndoActivityPubUrl(dislikeUrl) | 65 | const undoUrl = getUndoActivityPubUrl(dislikeUrl) |
57 | 66 | ||
67 | const accountsInvolvedInVideo = await getAccountsInvolvedInVideo(video) | ||
68 | const audience = getOriginVideoAudience(video, accountsInvolvedInVideo) | ||
58 | const dislikeActivity = createDislikeActivityData(byAccount, video) | 69 | const dislikeActivity = createDislikeActivityData(byAccount, video) |
59 | const object = await createActivityData(undoUrl, byAccount, dislikeActivity) | 70 | const object = await createActivityData(undoUrl, byAccount, dislikeActivity, audience) |
60 | 71 | ||
61 | const data = await undoActivityData(undoUrl, byAccount, object) | 72 | const data = await undoActivityData(undoUrl, byAccount, object) |
62 | 73 | ||
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 () { | |||
67 | } | 67 | } |
68 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) | 68 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) |
69 | 69 | ||
70 | await wait(10000) | 70 | await wait(20000) |
71 | 71 | ||
72 | const res = await getVideosList(servers[1].url) | 72 | const res = await getVideosList(servers[1].url) |
73 | 73 | ||