diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-03 16:38:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-03 16:38:50 +0100 |
commit | 265ba139ebf56bbdc1c65f6ea4f367774c691fc0 (patch) | |
tree | c7c52d1ae48a35b8f9aa06a9fa2335a6ba502fd1 /server/lib/activitypub/send/send-update.ts | |
parent | 9bce811268cd74b402176ae9fcd8b77ac887576e (diff) | |
download | PeerTube-265ba139ebf56bbdc1c65f6ea4f367774c691fc0.tar.gz PeerTube-265ba139ebf56bbdc1c65f6ea4f367774c691fc0.tar.zst PeerTube-265ba139ebf56bbdc1c65f6ea4f367774c691fc0.zip |
Send account activitypub update events
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 | ||