aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub/actor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/activitypub/actor.ts')
-rw-r--r--server/models/activitypub/actor.ts42
1 files changed, 2 insertions, 40 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index ec0b4b2d9..e16bd5d79 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -49,7 +49,8 @@ export const unusedActorAttributesForAPI = [
49 'outboxUrl', 49 'outboxUrl',
50 'sharedInboxUrl', 50 'sharedInboxUrl',
51 'followersUrl', 51 'followersUrl',
52 'followingUrl' 52 'followingUrl',
53 'url'
53] 54]
54 55
55@DefaultScope({ 56@DefaultScope({
@@ -322,45 +323,6 @@ export class ActorModel extends Model<ActorModel> {
322 }) 323 })
323 } 324 }
324 325
325 static async getActorsFollowerSharedInboxUrls (actors: ActorModel[], t: Sequelize.Transaction) {
326 const query = {
327 // attribute: [],
328 where: {
329 id: {
330 [Sequelize.Op.in]: actors.map(a => a.id)
331 }
332 },
333 include: [
334 {
335 // attributes: [ ],
336 model: ActorFollowModel.unscoped(),
337 required: true,
338 as: 'ActorFollowers',
339 where: {
340 state: 'accepted'
341 },
342 include: [
343 {
344 attributes: [ 'sharedInboxUrl' ],
345 model: ActorModel.unscoped(),
346 as: 'ActorFollower',
347 required: true
348 }
349 ]
350 }
351 ],
352 transaction: t
353 }
354
355 const hash: { [ id: number ]: string[] } = {}
356 const res = await ActorModel.findAll(query)
357 for (const actor of res) {
358 hash[actor.id] = actor.ActorFollowers.map(follow => follow.ActorFollower.sharedInboxUrl)
359 }
360
361 return hash
362 }
363
364 toFormattedJSON () { 326 toFormattedJSON () {
365 let avatar: Avatar = null 327 let avatar: Avatar = null
366 if (this.Avatar) { 328 if (this.Avatar) {