diff options
Diffstat (limited to 'server/lib/activitypub/send/send-undo.ts')
-rw-r--r-- | server/lib/activitypub/send/send-undo.ts | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index 015f02b35..699f920f0 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts | |||
@@ -5,10 +5,10 @@ import { | |||
5 | ActivityFollow, | 5 | ActivityFollow, |
6 | ActivityLike, | 6 | ActivityLike, |
7 | ActivityUndo | 7 | ActivityUndo |
8 | } from '../../../../shared/models/activitypub/activity' | 8 | } from '../../../../shared/models/activitypub' |
9 | import { AccountInstance } from '../../../models' | 9 | import { AccountModel } from '../../../models/account/account' |
10 | import { AccountFollowInstance } from '../../../models/account/account-follow-interface' | 10 | import { AccountFollowModel } from '../../../models/account/account-follow' |
11 | import { VideoInstance } from '../../../models/video/video-interface' | 11 | import { VideoModel } from '../../../models/video/video' |
12 | import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' | 12 | import { getAccountFollowActivityPubUrl, getUndoActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' |
13 | import { | 13 | import { |
14 | broadcastToFollowers, | 14 | broadcastToFollowers, |
@@ -22,7 +22,7 @@ import { createActivityData, createDislikeActivityData } from './send-create' | |||
22 | import { followActivityData } from './send-follow' | 22 | import { followActivityData } from './send-follow' |
23 | import { likeActivityData } from './send-like' | 23 | import { likeActivityData } from './send-like' |
24 | 24 | ||
25 | async function sendUndoFollow (accountFollow: AccountFollowInstance, t: Transaction) { | 25 | async function sendUndoFollow (accountFollow: AccountFollowModel, t: Transaction) { |
26 | const me = accountFollow.AccountFollower | 26 | const me = accountFollow.AccountFollower |
27 | const following = accountFollow.AccountFollowing | 27 | const following = accountFollow.AccountFollowing |
28 | 28 | ||
@@ -35,7 +35,7 @@ async function sendUndoFollow (accountFollow: AccountFollowInstance, t: Transact | |||
35 | return unicastTo(data, me, following.inboxUrl, t) | 35 | return unicastTo(data, me, following.inboxUrl, t) |
36 | } | 36 | } |
37 | 37 | ||
38 | async function sendUndoLikeToOrigin (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { | 38 | async function sendUndoLikeToOrigin (byAccount: AccountModel, video: VideoModel, t: Transaction) { |
39 | const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) | 39 | const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) |
40 | const undoUrl = getUndoActivityPubUrl(likeUrl) | 40 | const undoUrl = getUndoActivityPubUrl(likeUrl) |
41 | 41 | ||
@@ -47,7 +47,7 @@ async function sendUndoLikeToOrigin (byAccount: AccountInstance, video: VideoIns | |||
47 | return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) | 47 | return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) |
48 | } | 48 | } |
49 | 49 | ||
50 | async function sendUndoLikeToVideoFollowers (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { | 50 | async function sendUndoLikeToVideoFollowers (byAccount: AccountModel, video: VideoModel, t: Transaction) { |
51 | const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) | 51 | const likeUrl = getVideoLikeActivityPubUrl(byAccount, video) |
52 | const undoUrl = getUndoActivityPubUrl(likeUrl) | 52 | const undoUrl = getUndoActivityPubUrl(likeUrl) |
53 | 53 | ||
@@ -60,7 +60,7 @@ async function sendUndoLikeToVideoFollowers (byAccount: AccountInstance, video: | |||
60 | return broadcastToFollowers(data, byAccount, toAccountsFollowers, t, followersException) | 60 | return broadcastToFollowers(data, byAccount, toAccountsFollowers, t, followersException) |
61 | } | 61 | } |
62 | 62 | ||
63 | async function sendUndoDislikeToOrigin (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { | 63 | async function sendUndoDislikeToOrigin (byAccount: AccountModel, video: VideoModel, t: Transaction) { |
64 | const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) | 64 | const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) |
65 | const undoUrl = getUndoActivityPubUrl(dislikeUrl) | 65 | const undoUrl = getUndoActivityPubUrl(dislikeUrl) |
66 | 66 | ||
@@ -74,7 +74,7 @@ async function sendUndoDislikeToOrigin (byAccount: AccountInstance, video: Video | |||
74 | return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) | 74 | return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t) |
75 | } | 75 | } |
76 | 76 | ||
77 | async function sendUndoDislikeToVideoFollowers (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { | 77 | async function sendUndoDislikeToVideoFollowers (byAccount: AccountModel, video: VideoModel, t: Transaction) { |
78 | const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) | 78 | const dislikeUrl = getVideoDislikeActivityPubUrl(byAccount, video) |
79 | const undoUrl = getUndoActivityPubUrl(dislikeUrl) | 79 | const undoUrl = getUndoActivityPubUrl(dislikeUrl) |
80 | 80 | ||
@@ -103,16 +103,16 @@ export { | |||
103 | 103 | ||
104 | async function undoActivityData ( | 104 | async function undoActivityData ( |
105 | url: string, | 105 | url: string, |
106 | byAccount: AccountInstance, | 106 | byAccount: AccountModel, |
107 | object: ActivityFollow | ActivityLike | ActivityCreate, | 107 | object: ActivityFollow | ActivityLike | ActivityCreate, |
108 | t: Transaction, | 108 | t: Transaction, |
109 | audience?: ActivityAudience | 109 | audience?: ActivityAudience |
110 | ) { | 110 | ): Promise<ActivityUndo> { |
111 | if (!audience) { | 111 | if (!audience) { |
112 | audience = await getAudience(byAccount, t) | 112 | audience = await getAudience(byAccount, t) |
113 | } | 113 | } |
114 | 114 | ||
115 | const activity: ActivityUndo = { | 115 | return { |
116 | type: 'Undo', | 116 | type: 'Undo', |
117 | id: url, | 117 | id: url, |
118 | actor: byAccount.url, | 118 | actor: byAccount.url, |
@@ -120,6 +120,4 @@ async function undoActivityData ( | |||
120 | cc: audience.cc, | 120 | cc: audience.cc, |
121 | object | 121 | object |
122 | } | 122 | } |
123 | |||
124 | return activity | ||
125 | } | 123 | } |