diff options
Diffstat (limited to 'server/models/activitypub')
-rw-r--r-- | server/models/activitypub/actor.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index ef8dd9f7c..f8bb59323 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -266,6 +266,18 @@ export class ActorModel extends Model<ActorModel> { | |||
266 | return ActorModel.unscoped().findById(id) | 266 | return ActorModel.unscoped().findById(id) |
267 | } | 267 | } |
268 | 268 | ||
269 | static isActorUrlExist (url: string) { | ||
270 | const query = { | ||
271 | raw: true, | ||
272 | where: { | ||
273 | url | ||
274 | } | ||
275 | } | ||
276 | |||
277 | return ActorModel.unscoped().findOne(query) | ||
278 | .then(a => !!a) | ||
279 | } | ||
280 | |||
269 | static listByFollowersUrls (followersUrls: string[], transaction?: Sequelize.Transaction) { | 281 | static listByFollowersUrls (followersUrls: string[], transaction?: Sequelize.Transaction) { |
270 | const query = { | 282 | const query = { |
271 | where: { | 283 | where: { |
@@ -315,6 +327,29 @@ export class ActorModel extends Model<ActorModel> { | |||
315 | where: { | 327 | where: { |
316 | url | 328 | url |
317 | }, | 329 | }, |
330 | transaction, | ||
331 | include: [ | ||
332 | { | ||
333 | attributes: [ 'id' ], | ||
334 | model: AccountModel.unscoped(), | ||
335 | required: false | ||
336 | }, | ||
337 | { | ||
338 | attributes: [ 'id' ], | ||
339 | model: VideoChannelModel.unscoped(), | ||
340 | required: false | ||
341 | } | ||
342 | ] | ||
343 | } | ||
344 | |||
345 | return ActorModel.unscoped().findOne(query) | ||
346 | } | ||
347 | |||
348 | static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Sequelize.Transaction) { | ||
349 | const query = { | ||
350 | where: { | ||
351 | url | ||
352 | }, | ||
318 | transaction | 353 | transaction |
319 | } | 354 | } |
320 | 355 | ||