aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-11 16:27:07 +0200
committerChocobozzz <me@florianbigard.com>2018-09-13 14:05:49 +0200
commitc48e82b5e0478434de30626d14594a97f2402e7c (patch)
treea78e5272bd0fe4f5b41831e571e02d05f1515b82 /server/models/activitypub
parenta651038487faa838bda3ce04695b08bc65baff70 (diff)
downloadPeerTube-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.ts4
-rw-r--r--server/models/activitypub/actor.ts13
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'
21import { FollowState } from '../../../shared/models/actors' 21import { FollowState } from '../../../shared/models/actors'
22import { AccountFollow } from '../../../shared/models/actors/follow.model' 22import { ActorFollow } from '../../../shared/models/actors/follow.model'
23import { logger } from '../../helpers/logger' 23import { logger } from '../../helpers/logger'
24import { getServerActor } from '../../helpers/utils' 24import { getServerActor } from '../../helpers/utils'
25import { ACTOR_FOLLOW_SCORE } from '../../initializers' 25import { 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