diff options
Diffstat (limited to 'server/lib/activitypub/send/send-update.ts')
-rw-r--r-- | server/lib/activitypub/send/send-update.ts | 16 |
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 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { ActivityAudience, ActivityUpdate } from '../../../../shared/models/activitypub' | 2 | import { ActivityAudience, ActivityUpdate } from '../../../../shared/models/activitypub' |
3 | import { VideoPrivacy } from '../../../../shared/models/videos' | 3 | import { VideoPrivacy } from '../../../../shared/models/videos' |
4 | import { UserModel } from '../../../models/account/user' | ||
4 | import { ActorModel } from '../../../models/activitypub/actor' | 5 | import { ActorModel } from '../../../models/activitypub/actor' |
5 | import { VideoModel } from '../../../models/video/video' | 6 | import { VideoModel } from '../../../models/video/video' |
6 | import { VideoShareModel } from '../../../models/video/video-share' | 7 | import { 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 | ||
26 | async 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 | ||
27 | export { | 42 | export { |
43 | sendUpdateUser, | ||
28 | sendUpdateVideo | 44 | sendUpdateVideo |
29 | } | 45 | } |
30 | 46 | ||