diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-18 11:17:35 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-18 11:21:50 +0100 |
commit | 57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c (patch) | |
tree | fcf12670d643ec4a3b5eccdfa834227c0417d988 /server/lib/activitypub/process | |
parent | 2e3f7a5a6fbae276d3ba1cb1b08289917ec7604b (diff) | |
download | PeerTube-57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c.tar.gz PeerTube-57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c.tar.zst PeerTube-57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c.zip |
Don't store remote rates of remote videos
In the future we'll stop to expose all available rates to improve users
privacy
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r-- | server/lib/activitypub/process/process-announce.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-delete.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-dislike.ts | 20 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-like.ts | 21 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-undo.ts | 61 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-update.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-view.ts | 2 |
8 files changed, 61 insertions, 53 deletions
diff --git a/server/lib/activitypub/process/process-announce.ts b/server/lib/activitypub/process/process-announce.ts index 2619d9754..200f8ce11 100644 --- a/server/lib/activitypub/process/process-announce.ts +++ b/server/lib/activitypub/process/process-announce.ts | |||
@@ -2,7 +2,7 @@ import { ActivityAnnounce } from '../../../../shared/models/activitypub' | |||
2 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 2 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
3 | import { sequelizeTypescript } from '../../../initializers/database' | 3 | import { sequelizeTypescript } from '../../../initializers/database' |
4 | import { VideoShareModel } from '../../../models/video/video-share' | 4 | import { VideoShareModel } from '../../../models/video/video-share' |
5 | import { forwardVideoRelatedActivity } from '../send/utils' | 5 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' |
6 | import { getOrCreateAPVideo } from '../videos' | 6 | import { getOrCreateAPVideo } from '../videos' |
7 | import { Notifier } from '../../notifier' | 7 | import { Notifier } from '../../notifier' |
8 | import { logger } from '../../../helpers/logger' | 8 | import { logger } from '../../../helpers/logger' |
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 3e8ad184c..b5b1a0feb 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts | |||
@@ -9,7 +9,7 @@ import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFile | |||
9 | import { Notifier } from '../../notifier' | 9 | import { Notifier } from '../../notifier' |
10 | import { createOrUpdateCacheFile } from '../cache-file' | 10 | import { createOrUpdateCacheFile } from '../cache-file' |
11 | import { createOrUpdateVideoPlaylist } from '../playlists' | 11 | import { createOrUpdateVideoPlaylist } from '../playlists' |
12 | import { forwardVideoRelatedActivity } from '../send/utils' | 12 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' |
13 | import { resolveThread } from '../video-comments' | 13 | import { resolveThread } from '../video-comments' |
14 | import { getOrCreateAPVideo } from '../videos' | 14 | import { getOrCreateAPVideo } from '../videos' |
15 | 15 | ||
@@ -55,7 +55,7 @@ export { | |||
55 | async function processCreateVideo (activity: ActivityCreate, notify: boolean) { | 55 | async function processCreateVideo (activity: ActivityCreate, notify: boolean) { |
56 | const videoToCreateData = activity.object as VideoObject | 56 | const videoToCreateData = activity.object as VideoObject |
57 | 57 | ||
58 | const syncParam = { likes: false, dislikes: false, shares: false, comments: false, thumbnail: true, refreshVideo: false } | 58 | const syncParam = { rates: false, shares: false, comments: false, thumbnail: true, refreshVideo: false } |
59 | const { video, created } = await getOrCreateAPVideo({ videoObject: videoToCreateData, syncParam }) | 59 | const { video, created } = await getOrCreateAPVideo({ videoObject: videoToCreateData, syncParam }) |
60 | 60 | ||
61 | if (created && notify) Notifier.Instance.notifyOnNewVideoIfNeeded(video) | 61 | if (created && notify) Notifier.Instance.notifyOnNewVideoIfNeeded(video) |
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index 1d2279df5..ac0e7e235 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts | |||
@@ -16,7 +16,7 @@ import { | |||
16 | MChannelActor, | 16 | MChannelActor, |
17 | MCommentOwnerVideo | 17 | MCommentOwnerVideo |
18 | } from '../../../types/models' | 18 | } from '../../../types/models' |
19 | import { forwardVideoRelatedActivity } from '../send/utils' | 19 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' |
20 | 20 | ||
21 | async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) { | 21 | async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) { |
22 | const { activity, byActor } = options | 22 | const { activity, byActor } = options |
diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts index 2f46b83d1..97a994e94 100644 --- a/server/lib/activitypub/process/process-dislike.ts +++ b/server/lib/activitypub/process/process-dislike.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import { VideoModel } from '@server/models/video/video' | ||
1 | import { ActivityCreate, ActivityDislike, DislikeObject } from '@shared/models' | 2 | import { ActivityCreate, ActivityDislike, DislikeObject } from '@shared/models' |
2 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
3 | import { sequelizeTypescript } from '../../../initializers/database' | 4 | import { sequelizeTypescript } from '../../../initializers/database' |
4 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 5 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
5 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' | 6 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' |
6 | import { MActorSignature } from '../../../types/models' | 7 | import { MActorSignature } from '../../../types/models' |
7 | import { forwardVideoRelatedActivity } from '../send/utils' | 8 | import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos' |
8 | import { getOrCreateAPVideo } from '../videos' | ||
9 | 9 | ||
10 | async function processDislikeActivity (options: APProcessorOptions<ActivityCreate | ActivityDislike>) { | 10 | async function processDislikeActivity (options: APProcessorOptions<ActivityCreate | ActivityDislike>) { |
11 | const { activity, byActor } = options | 11 | const { activity, byActor } = options |
@@ -29,16 +29,23 @@ async function processDislike (activity: ActivityCreate | ActivityDislike, byAct | |||
29 | 29 | ||
30 | if (!byAccount) throw new Error('Cannot create dislike with the non account actor ' + byActor.url) | 30 | if (!byAccount) throw new Error('Cannot create dislike with the non account actor ' + byActor.url) |
31 | 31 | ||
32 | const { video } = await getOrCreateAPVideo({ videoObject: dislikeObject }) | 32 | const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: dislikeObject, fetchType: 'only-video' }) |
33 | |||
34 | // We don't care about dislikes of remote videos | ||
35 | if (!onlyVideo.isOwned()) return | ||
33 | 36 | ||
34 | return sequelizeTypescript.transaction(async t => { | 37 | return sequelizeTypescript.transaction(async t => { |
38 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | ||
39 | |||
35 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) | 40 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) |
36 | if (existingRate && existingRate.type === 'dislike') return | 41 | if (existingRate && existingRate.type === 'dislike') return |
37 | 42 | ||
38 | await video.increment('dislikes', { transaction: t }) | 43 | await video.increment('dislikes', { transaction: t }) |
44 | video.dislikes++ | ||
39 | 45 | ||
40 | if (existingRate && existingRate.type === 'like') { | 46 | if (existingRate && existingRate.type === 'like') { |
41 | await video.decrement('likes', { transaction: t }) | 47 | await video.decrement('likes', { transaction: t }) |
48 | video.likes-- | ||
42 | } | 49 | } |
43 | 50 | ||
44 | const rate = existingRate || new AccountVideoRateModel() | 51 | const rate = existingRate || new AccountVideoRateModel() |
@@ -49,11 +56,6 @@ async function processDislike (activity: ActivityCreate | ActivityDislike, byAct | |||
49 | 56 | ||
50 | await rate.save({ transaction: t }) | 57 | await rate.save({ transaction: t }) |
51 | 58 | ||
52 | if (video.isOwned()) { | 59 | await federateVideoIfNeeded(video, false, t) |
53 | // Don't resend the activity to the sender | ||
54 | const exceptions = [ byActor ] | ||
55 | |||
56 | await forwardVideoRelatedActivity(activity, t, exceptions, video) | ||
57 | } | ||
58 | }) | 60 | }) |
59 | } | 61 | } |
diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts index cd4e86cbb..93afb5edf 100644 --- a/server/lib/activitypub/process/process-like.ts +++ b/server/lib/activitypub/process/process-like.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { VideoModel } from '@server/models/video/video' | ||
1 | import { ActivityLike } from '../../../../shared/models/activitypub' | 2 | import { ActivityLike } from '../../../../shared/models/activitypub' |
2 | import { getAPId } from '../../../helpers/activitypub' | 3 | import { getAPId } from '../../../helpers/activitypub' |
3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 4 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
@@ -5,11 +6,11 @@ import { sequelizeTypescript } from '../../../initializers/database' | |||
5 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 6 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
6 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' | 7 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' |
7 | import { MActorSignature } from '../../../types/models' | 8 | import { MActorSignature } from '../../../types/models' |
8 | import { forwardVideoRelatedActivity } from '../send/utils' | 9 | import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos' |
9 | import { getOrCreateAPVideo } from '../videos' | ||
10 | 10 | ||
11 | async function processLikeActivity (options: APProcessorOptions<ActivityLike>) { | 11 | async function processLikeActivity (options: APProcessorOptions<ActivityLike>) { |
12 | const { activity, byActor } = options | 12 | const { activity, byActor } = options |
13 | |||
13 | return retryTransactionWrapper(processLikeVideo, byActor, activity) | 14 | return retryTransactionWrapper(processLikeVideo, byActor, activity) |
14 | } | 15 | } |
15 | 16 | ||
@@ -27,17 +28,24 @@ async function processLikeVideo (byActor: MActorSignature, activity: ActivityLik | |||
27 | const byAccount = byActor.Account | 28 | const byAccount = byActor.Account |
28 | if (!byAccount) throw new Error('Cannot create like with the non account actor ' + byActor.url) | 29 | if (!byAccount) throw new Error('Cannot create like with the non account actor ' + byActor.url) |
29 | 30 | ||
30 | const { video } = await getOrCreateAPVideo({ videoObject: videoUrl }) | 31 | const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: videoUrl, fetchType: 'only-video' }) |
32 | |||
33 | // We don't care about likes of remote videos | ||
34 | if (!onlyVideo.isOwned()) return | ||
31 | 35 | ||
32 | return sequelizeTypescript.transaction(async t => { | 36 | return sequelizeTypescript.transaction(async t => { |
37 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | ||
38 | |||
33 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) | 39 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) |
34 | if (existingRate && existingRate.type === 'like') return | 40 | if (existingRate && existingRate.type === 'like') return |
35 | 41 | ||
36 | if (existingRate && existingRate.type === 'dislike') { | 42 | if (existingRate && existingRate.type === 'dislike') { |
37 | await video.decrement('dislikes', { transaction: t }) | 43 | await video.decrement('dislikes', { transaction: t }) |
44 | video.dislikes-- | ||
38 | } | 45 | } |
39 | 46 | ||
40 | await video.increment('likes', { transaction: t }) | 47 | await video.increment('likes', { transaction: t }) |
48 | video.likes++ | ||
41 | 49 | ||
42 | const rate = existingRate || new AccountVideoRateModel() | 50 | const rate = existingRate || new AccountVideoRateModel() |
43 | rate.type = 'like' | 51 | rate.type = 'like' |
@@ -47,11 +55,6 @@ async function processLikeVideo (byActor: MActorSignature, activity: ActivityLik | |||
47 | 55 | ||
48 | await rate.save({ transaction: t }) | 56 | await rate.save({ transaction: t }) |
49 | 57 | ||
50 | if (video.isOwned()) { | 58 | await federateVideoIfNeeded(video, false, t) |
51 | // Don't resend the activity to the sender | ||
52 | const exceptions = [ byActor ] | ||
53 | |||
54 | await forwardVideoRelatedActivity(activity, t, exceptions, video) | ||
55 | } | ||
56 | }) | 59 | }) |
57 | } | 60 | } |
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts index d4b2a795f..257eb6c2b 100644 --- a/server/lib/activitypub/process/process-undo.ts +++ b/server/lib/activitypub/process/process-undo.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { VideoModel } from '@server/models/video/video' | ||
1 | import { ActivityAnnounce, ActivityFollow, ActivityLike, ActivityUndo, CacheFileObject } from '../../../../shared/models/activitypub' | 2 | import { ActivityAnnounce, ActivityFollow, ActivityLike, ActivityUndo, CacheFileObject } from '../../../../shared/models/activitypub' |
2 | import { DislikeObject } from '../../../../shared/models/activitypub/objects' | 3 | import { DislikeObject } from '../../../../shared/models/activitypub/objects' |
3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 4 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
@@ -10,8 +11,8 @@ import { VideoRedundancyModel } from '../../../models/redundancy/video-redundanc | |||
10 | import { VideoShareModel } from '../../../models/video/video-share' | 11 | import { VideoShareModel } from '../../../models/video/video-share' |
11 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' | 12 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' |
12 | import { MActorSignature } from '../../../types/models' | 13 | import { MActorSignature } from '../../../types/models' |
13 | import { forwardVideoRelatedActivity } from '../send/utils' | 14 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' |
14 | import { getOrCreateAPVideo } from '../videos' | 15 | import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos' |
15 | 16 | ||
16 | async function processUndoActivity (options: APProcessorOptions<ActivityUndo>) { | 17 | async function processUndoActivity (options: APProcessorOptions<ActivityUndo>) { |
17 | const { activity, byActor } = options | 18 | const { activity, byActor } = options |
@@ -55,23 +56,22 @@ export { | |||
55 | async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo) { | 56 | async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo) { |
56 | const likeActivity = activity.object as ActivityLike | 57 | const likeActivity = activity.object as ActivityLike |
57 | 58 | ||
58 | const { video } = await getOrCreateAPVideo({ videoObject: likeActivity.object }) | 59 | const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: likeActivity.object }) |
60 | // We don't care about likes of remote videos | ||
61 | if (!onlyVideo.isOwned()) return | ||
59 | 62 | ||
60 | return sequelizeTypescript.transaction(async t => { | 63 | return sequelizeTypescript.transaction(async t => { |
61 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) | 64 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) |
62 | 65 | ||
66 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | ||
63 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t) | 67 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t) |
64 | if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`) | 68 | if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`) |
65 | 69 | ||
66 | await rate.destroy({ transaction: t }) | 70 | await rate.destroy({ transaction: t }) |
67 | await video.decrement('likes', { transaction: t }) | 71 | await video.decrement('likes', { transaction: t }) |
68 | 72 | ||
69 | if (video.isOwned()) { | 73 | video.likes-- |
70 | // Don't resend the activity to the sender | 74 | await federateVideoIfNeeded(video, false, t) |
71 | const exceptions = [ byActor ] | ||
72 | |||
73 | await forwardVideoRelatedActivity(activity, t, exceptions, video) | ||
74 | } | ||
75 | }) | 75 | }) |
76 | } | 76 | } |
77 | 77 | ||
@@ -80,26 +80,27 @@ async function processUndoDislike (byActor: MActorSignature, activity: ActivityU | |||
80 | ? activity.object | 80 | ? activity.object |
81 | : activity.object.object as DislikeObject | 81 | : activity.object.object as DislikeObject |
82 | 82 | ||
83 | const { video } = await getOrCreateAPVideo({ videoObject: dislike.object }) | 83 | const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: dislike.object }) |
84 | // We don't care about likes of remote videos | ||
85 | if (!onlyVideo.isOwned()) return | ||
84 | 86 | ||
85 | return sequelizeTypescript.transaction(async t => { | 87 | return sequelizeTypescript.transaction(async t => { |
86 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) | 88 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) |
87 | 89 | ||
90 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | ||
88 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) | 91 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) |
89 | if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`) | 92 | if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`) |
90 | 93 | ||
91 | await rate.destroy({ transaction: t }) | 94 | await rate.destroy({ transaction: t }) |
92 | await video.decrement('dislikes', { transaction: t }) | 95 | await video.decrement('dislikes', { transaction: t }) |
96 | video.dislikes-- | ||
93 | 97 | ||
94 | if (video.isOwned()) { | 98 | await federateVideoIfNeeded(video, false, t) |
95 | // Don't resend the activity to the sender | ||
96 | const exceptions = [ byActor ] | ||
97 | |||
98 | await forwardVideoRelatedActivity(activity, t, exceptions, video) | ||
99 | } | ||
100 | }) | 99 | }) |
101 | } | 100 | } |
102 | 101 | ||
102 | // --------------------------------------------------------------------------- | ||
103 | |||
103 | async function processUndoCacheFile (byActor: MActorSignature, activity: ActivityUndo) { | 104 | async function processUndoCacheFile (byActor: MActorSignature, activity: ActivityUndo) { |
104 | const cacheFileObject = activity.object.object as CacheFileObject | 105 | const cacheFileObject = activity.object.object as CacheFileObject |
105 | 106 | ||
@@ -125,19 +126,6 @@ async function processUndoCacheFile (byActor: MActorSignature, activity: Activit | |||
125 | }) | 126 | }) |
126 | } | 127 | } |
127 | 128 | ||
128 | function processUndoFollow (follower: MActorSignature, followActivity: ActivityFollow) { | ||
129 | return sequelizeTypescript.transaction(async t => { | ||
130 | const following = await ActorModel.loadByUrlAndPopulateAccountAndChannel(followActivity.object, t) | ||
131 | const actorFollow = await ActorFollowModel.loadByActorAndTarget(follower.id, following.id, t) | ||
132 | |||
133 | if (!actorFollow) throw new Error(`'Unknown actor follow ${follower.id} -> ${following.id}.`) | ||
134 | |||
135 | await actorFollow.destroy({ transaction: t }) | ||
136 | |||
137 | return undefined | ||
138 | }) | ||
139 | } | ||
140 | |||
141 | function processUndoAnnounce (byActor: MActorSignature, announceActivity: ActivityAnnounce) { | 129 | function processUndoAnnounce (byActor: MActorSignature, announceActivity: ActivityAnnounce) { |
142 | return sequelizeTypescript.transaction(async t => { | 130 | return sequelizeTypescript.transaction(async t => { |
143 | const share = await VideoShareModel.loadByUrl(announceActivity.id, t) | 131 | const share = await VideoShareModel.loadByUrl(announceActivity.id, t) |
@@ -155,3 +143,18 @@ function processUndoAnnounce (byActor: MActorSignature, announceActivity: Activi | |||
155 | } | 143 | } |
156 | }) | 144 | }) |
157 | } | 145 | } |
146 | |||
147 | // --------------------------------------------------------------------------- | ||
148 | |||
149 | function processUndoFollow (follower: MActorSignature, followActivity: ActivityFollow) { | ||
150 | return sequelizeTypescript.transaction(async t => { | ||
151 | const following = await ActorModel.loadByUrlAndPopulateAccountAndChannel(followActivity.object, t) | ||
152 | const actorFollow = await ActorFollowModel.loadByActorAndTarget(follower.id, following.id, t) | ||
153 | |||
154 | if (!actorFollow) throw new Error(`'Unknown actor follow ${follower.id} -> ${following.id}.`) | ||
155 | |||
156 | await actorFollow.destroy({ transaction: t }) | ||
157 | |||
158 | return undefined | ||
159 | }) | ||
160 | } | ||
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index f40008a6b..4afdbd430 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts | |||
@@ -13,7 +13,7 @@ import { MActorFull, MActorSignature } from '../../../types/models' | |||
13 | import { APActorUpdater } from '../actors/updater' | 13 | import { APActorUpdater } from '../actors/updater' |
14 | import { createOrUpdateCacheFile } from '../cache-file' | 14 | import { createOrUpdateCacheFile } from '../cache-file' |
15 | import { createOrUpdateVideoPlaylist } from '../playlists' | 15 | import { createOrUpdateVideoPlaylist } from '../playlists' |
16 | import { forwardVideoRelatedActivity } from '../send/utils' | 16 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' |
17 | import { APVideoUpdater, getOrCreateAPVideo } from '../videos' | 17 | import { APVideoUpdater, getOrCreateAPVideo } from '../videos' |
18 | 18 | ||
19 | async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) { | 19 | async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) { |
diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.ts index 720385f9b..c59940164 100644 --- a/server/lib/activitypub/process/process-view.ts +++ b/server/lib/activitypub/process/process-view.ts | |||
@@ -2,7 +2,7 @@ import { VideoViews } from '@server/lib/video-views' | |||
2 | import { ActivityView } from '../../../../shared/models/activitypub' | 2 | import { ActivityView } from '../../../../shared/models/activitypub' |
3 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' | 3 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' |
4 | import { MActorSignature } from '../../../types/models' | 4 | import { MActorSignature } from '../../../types/models' |
5 | import { forwardVideoRelatedActivity } from '../send/utils' | 5 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' |
6 | import { getOrCreateAPVideo } from '../videos' | 6 | import { getOrCreateAPVideo } from '../videos' |
7 | 7 | ||
8 | async function processViewActivity (options: APProcessorOptions<ActivityView>) { | 8 | async function processViewActivity (options: APProcessorOptions<ActivityView>) { |