aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-28 08:45:03 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-28 08:45:03 +0100
commit5e3bb76cb6cc17ff2ba5a492ea3ed8358e66a00a (patch)
tree241054396eddeae9f7a52e2551622112a5d2e85c /server
parenta2431b7dcbc72c05101dcdbe631ff84a823aeb51 (diff)
downloadPeerTube-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.ts17
-rw-r--r--server/tests/api/video-transcoder.ts2
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'
10import { AccountFollowInstance } from '../../../models/account/account-follow-interface' 10import { AccountFollowInstance } from '../../../models/account/account-follow-interface'
11import { VideoInstance } from '../../../models/video/video-interface' 11import { VideoInstance } from '../../../models/video/video-interface'
12import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' 12import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url'
13import { broadcastToFollowers, getAccountsInvolvedInVideo, getAudience, getObjectFollowersAudience, unicastTo } from './misc' 13import {
14 broadcastToFollowers,
15 getAccountsInvolvedInVideo,
16 getAudience,
17 getObjectFollowersAudience,
18 getOriginVideoAudience,
19 unicastTo
20} from './misc'
14import { createActivityData, createDislikeActivityData } from './send-create' 21import { createActivityData, createDislikeActivityData } from './send-create'
15import { followActivityData } from './send-follow' 22import { followActivityData } from './send-follow'
16import { likeActivityData } from './send-like' 23import { 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