aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/send-update.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/send/send-update.ts')
-rw-r--r--server/lib/activitypub/send/send-update.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts
index b623fec6c..e8f11edd0 100644
--- a/server/lib/activitypub/send/send-update.ts
+++ b/server/lib/activitypub/send/send-update.ts
@@ -1,6 +1,7 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { ActivityAudience, ActivityUpdate } from '../../../../shared/models/activitypub' 2import { ActivityAudience, ActivityUpdate } from '../../../../shared/models/activitypub'
3import { VideoPrivacy } from '../../../../shared/models/videos' 3import { VideoPrivacy } from '../../../../shared/models/videos'
4import { UserModel } from '../../../models/account/user'
4import { ActorModel } from '../../../models/activitypub/actor' 5import { ActorModel } from '../../../models/activitypub/actor'
5import { VideoModel } from '../../../models/video/video' 6import { VideoModel } from '../../../models/video/video'
6import { VideoShareModel } from '../../../models/video/video-share' 7import { VideoShareModel } from '../../../models/video/video-share'
@@ -22,9 +23,24 @@ async function sendUpdateVideo (video: VideoModel, t: Transaction) {
22 return broadcastToFollowers(data, byActor, actorsInvolved, t) 23 return broadcastToFollowers(data, byActor, actorsInvolved, t)
23} 24}
24 25
26async function sendUpdateUser (user: UserModel, t: Transaction) {
27 const byActor = user.Account.Actor
28
29 const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
30 const accountObject = user.Account.toActivityPubObject()
31 const audience = await getAudience(byActor, t)
32 const data = await updateActivityData(url, byActor, accountObject, t, audience)
33
34 const actorsInvolved = await VideoShareModel.loadActorsByVideoOwner(byActor.id, t)
35 actorsInvolved.push(byActor)
36
37 return broadcastToFollowers(data, byActor, actorsInvolved, t)
38}
39
25// --------------------------------------------------------------------------- 40// ---------------------------------------------------------------------------
26 41
27export { 42export {
43 sendUpdateUser,
28 sendUpdateVideo 44 sendUpdateVideo
29} 45}
30 46