aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-24 13:07:33 +0200
committerChocobozzz <me@florianbigard.com>2018-09-24 13:38:39 +0200
commite5565833f62b97f62ea75eba5b479963ae78b873 (patch)
tree835793ce464f9666b0ceae79f3d278cc4e007b32 /server/models/activitypub
parentd1a63fc7ac58a1db00d8ca4f43aadba02eb9b084 (diff)
downloadPeerTube-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.ts31
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'
37import { throwIfNotValid } from '../utils' 37import { throwIfNotValid } from '../utils'
38import { VideoChannelModel } from '../video/video-channel' 38import { VideoChannelModel } from '../video/video-channel'
39import { ActorFollowModel } from './actor-follow' 39import { ActorFollowModel } from './actor-follow'
40import { VideoModel } from '../video/video'
40 41
41enum ScopeNames { 42enum 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,