aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/actor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/actor.ts')
-rw-r--r--server/lib/activitypub/actor.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index c3255d8ca..897acee85 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -225,12 +225,10 @@ function saveActorAndServerAndModelIfNotExist (
225 }) 225 })
226 226
227 if (actorCreated.type === 'Person' || actorCreated.type === 'Application') { 227 if (actorCreated.type === 'Person' || actorCreated.type === 'Application') {
228 const account = await saveAccount(actorCreated, result, t) 228 actorCreated.Account = await saveAccount(actorCreated, result, t)
229 actorCreated.Account = account
230 actorCreated.Account.Actor = actorCreated 229 actorCreated.Account.Actor = actorCreated
231 } else if (actorCreated.type === 'Group') { // Video channel 230 } else if (actorCreated.type === 'Group') { // Video channel
232 const videoChannel = await saveVideoChannel(actorCreated, result, ownerActor, t) 231 actorCreated.VideoChannel = await saveVideoChannel(actorCreated, result, ownerActor, t)
233 actorCreated.VideoChannel = videoChannel
234 actorCreated.VideoChannel.Actor = actorCreated 232 actorCreated.VideoChannel.Actor = actorCreated
235 } 233 }
236 234
@@ -242,6 +240,7 @@ type FetchRemoteActorResult = {
242 actor: ActorModel 240 actor: ActorModel
243 name: string 241 name: string
244 summary: string 242 summary: string
243 support?: string
245 avatarName?: string 244 avatarName?: string
246 attributedTo: ActivityPubAttributedTo[] 245 attributedTo: ActivityPubAttributedTo[]
247} 246}
@@ -290,6 +289,7 @@ async function fetchRemoteActor (actorUrl: string): Promise<FetchRemoteActorResu
290 name, 289 name,
291 avatarName, 290 avatarName,
292 summary: actorJSON.summary, 291 summary: actorJSON.summary,
292 support: actorJSON.support,
293 attributedTo: actorJSON.attributedTo 293 attributedTo: actorJSON.attributedTo
294 } 294 }
295} 295}
@@ -298,6 +298,7 @@ async function saveAccount (actor: ActorModel, result: FetchRemoteActorResult, t
298 const [ accountCreated ] = await AccountModel.findOrCreate({ 298 const [ accountCreated ] = await AccountModel.findOrCreate({
299 defaults: { 299 defaults: {
300 name: result.name, 300 name: result.name,
301 description: result.summary,
301 actorId: actor.id 302 actorId: actor.id
302 }, 303 },
303 where: { 304 where: {
@@ -314,6 +315,7 @@ async function saveVideoChannel (actor: ActorModel, result: FetchRemoteActorResu
314 defaults: { 315 defaults: {
315 name: result.name, 316 name: result.name,
316 description: result.summary, 317 description: result.summary,
318 support: result.support,
317 actorId: actor.id, 319 actorId: actor.id,
318 accountId: ownerActor.Account.id 320 accountId: ownerActor.Account.id
319 }, 321 },
@@ -352,11 +354,14 @@ async function refreshActorIfNeeded (actor: ActorModel) {
352 await actor.save({ transaction: t }) 354 await actor.save({ transaction: t })
353 355
354 actor.Account.set('name', result.name) 356 actor.Account.set('name', result.name)
357 actor.Account.set('description', result.summary)
355 await actor.Account.save({ transaction: t }) 358 await actor.Account.save({ transaction: t })
356 } else if (actor.VideoChannel) { 359 } else if (actor.VideoChannel) {
357 await actor.save({ transaction: t }) 360 await actor.save({ transaction: t })
358 361
359 actor.VideoChannel.set('name', result.name) 362 actor.VideoChannel.set('name', result.name)
363 actor.VideoChannel.set('description', result.summary)
364 actor.VideoChannel.set('support', result.support)
360 await actor.VideoChannel.save({ transaction: t }) 365 await actor.VideoChannel.save({ transaction: t })
361 } 366 }
362 367