diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-24 13:07:33 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-24 13:38:39 +0200 |
commit | e5565833f62b97f62ea75eba5b479963ae78b873 (patch) | |
tree | 835793ce464f9666b0ceae79f3d278cc4e007b32 /server/models/activitypub | |
parent | d1a63fc7ac58a1db00d8ca4f43aadba02eb9b084 (diff) | |
download | PeerTube-e5565833f62b97f62ea75eba5b479963ae78b873.tar.gz PeerTube-e5565833f62b97f62ea75eba5b479963ae78b873.tar.zst PeerTube-e5565833f62b97f62ea75eba5b479963ae78b873.zip |
Improve redundancy: add 'min_lifetime' configuration
Diffstat (limited to 'server/models/activitypub')
-rw-r--r-- | server/models/activitypub/actor.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index f8bb59323..12b83916e 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -37,6 +37,7 @@ import { ServerModel } from '../server/server' | |||
37 | import { throwIfNotValid } from '../utils' | 37 | import { throwIfNotValid } from '../utils' |
38 | import { VideoChannelModel } from '../video/video-channel' | 38 | import { VideoChannelModel } from '../video/video-channel' |
39 | import { ActorFollowModel } from './actor-follow' | 39 | import { ActorFollowModel } from './actor-follow' |
40 | import { VideoModel } from '../video/video' | ||
40 | 41 | ||
41 | enum ScopeNames { | 42 | enum ScopeNames { |
42 | FULL = 'FULL' | 43 | FULL = 'FULL' |
@@ -266,6 +267,36 @@ export class ActorModel extends Model<ActorModel> { | |||
266 | return ActorModel.unscoped().findById(id) | 267 | return ActorModel.unscoped().findById(id) |
267 | } | 268 | } |
268 | 269 | ||
270 | static loadAccountActorByVideoId (videoId: number, transaction: Sequelize.Transaction) { | ||
271 | const query = { | ||
272 | include: [ | ||
273 | { | ||
274 | attributes: [ 'id' ], | ||
275 | model: AccountModel.unscoped(), | ||
276 | required: true, | ||
277 | include: [ | ||
278 | { | ||
279 | attributes: [ 'id' ], | ||
280 | model: VideoChannelModel.unscoped(), | ||
281 | required: true, | ||
282 | include: { | ||
283 | attributes: [ 'id' ], | ||
284 | model: VideoModel.unscoped(), | ||
285 | required: true, | ||
286 | where: { | ||
287 | id: videoId | ||
288 | } | ||
289 | } | ||
290 | } | ||
291 | ] | ||
292 | } | ||
293 | ], | ||
294 | transaction | ||
295 | } | ||
296 | |||
297 | return ActorModel.unscoped().findOne(query as any) // FIXME: typings | ||
298 | } | ||
299 | |||
269 | static isActorUrlExist (url: string) { | 300 | static isActorUrlExist (url: string) { |
270 | const query = { | 301 | const query = { |
271 | raw: true, | 302 | raw: true, |