diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-11 16:27:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-13 14:05:49 +0200 |
commit | c48e82b5e0478434de30626d14594a97f2402e7c (patch) | |
tree | a78e5272bd0fe4f5b41831e571e02d05f1515b82 /server/models/activitypub | |
parent | a651038487faa838bda3ce04695b08bc65baff70 (diff) | |
download | PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.gz PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.zst PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.zip |
Basic video redundancy implementation
Diffstat (limited to 'server/models/activitypub')
-rw-r--r-- | server/models/activitypub/actor-follow.ts | 4 | ||||
-rw-r--r-- | server/models/activitypub/actor.ts | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 8bc095997..27bb43dae 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts | |||
@@ -19,7 +19,7 @@ import { | |||
19 | UpdatedAt | 19 | UpdatedAt |
20 | } from 'sequelize-typescript' | 20 | } from 'sequelize-typescript' |
21 | import { FollowState } from '../../../shared/models/actors' | 21 | import { FollowState } from '../../../shared/models/actors' |
22 | import { AccountFollow } from '../../../shared/models/actors/follow.model' | 22 | import { ActorFollow } from '../../../shared/models/actors/follow.model' |
23 | import { logger } from '../../helpers/logger' | 23 | import { logger } from '../../helpers/logger' |
24 | import { getServerActor } from '../../helpers/utils' | 24 | import { getServerActor } from '../../helpers/utils' |
25 | import { ACTOR_FOLLOW_SCORE } from '../../initializers' | 25 | import { ACTOR_FOLLOW_SCORE } from '../../initializers' |
@@ -529,7 +529,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
529 | return ActorFollowModel.findAll(query) | 529 | return ActorFollowModel.findAll(query) |
530 | } | 530 | } |
531 | 531 | ||
532 | toFormattedJSON (): AccountFollow { | 532 | toFormattedJSON (): ActorFollow { |
533 | const follower = this.ActorFollower.toFormattedJSON() | 533 | const follower = this.ActorFollower.toFormattedJSON() |
534 | const following = this.ActorFollowing.toFormattedJSON() | 534 | const following = this.ActorFollowing.toFormattedJSON() |
535 | 535 | ||
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 119d0c1da..ef8dd9f7c 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -76,7 +76,13 @@ export const unusedActorAttributesForAPI = [ | |||
76 | }, | 76 | }, |
77 | { | 77 | { |
78 | model: () => VideoChannelModel.unscoped(), | 78 | model: () => VideoChannelModel.unscoped(), |
79 | required: false | 79 | required: false, |
80 | include: [ | ||
81 | { | ||
82 | model: () => AccountModel, | ||
83 | required: true | ||
84 | } | ||
85 | ] | ||
80 | }, | 86 | }, |
81 | { | 87 | { |
82 | model: () => ServerModel, | 88 | model: () => ServerModel, |
@@ -337,6 +343,7 @@ export class ActorModel extends Model<ActorModel> { | |||
337 | uuid: this.uuid, | 343 | uuid: this.uuid, |
338 | name: this.preferredUsername, | 344 | name: this.preferredUsername, |
339 | host: this.getHost(), | 345 | host: this.getHost(), |
346 | hostRedundancyAllowed: this.getRedundancyAllowed(), | ||
340 | followingCount: this.followingCount, | 347 | followingCount: this.followingCount, |
341 | followersCount: this.followersCount, | 348 | followersCount: this.followersCount, |
342 | avatar, | 349 | avatar, |
@@ -440,6 +447,10 @@ export class ActorModel extends Model<ActorModel> { | |||
440 | return this.Server ? this.Server.host : CONFIG.WEBSERVER.HOST | 447 | return this.Server ? this.Server.host : CONFIG.WEBSERVER.HOST |
441 | } | 448 | } |
442 | 449 | ||
450 | getRedundancyAllowed () { | ||
451 | return this.Server ? this.Server.redundancyAllowed : false | ||
452 | } | ||
453 | |||
443 | getAvatarUrl () { | 454 | getAvatarUrl () { |
444 | if (!this.avatarId) return undefined | 455 | if (!this.avatarId) return undefined |
445 | 456 | ||