aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-20 19:05:31 +0200
committerChocobozzz <me@florianbigard.com>2019-08-20 19:23:10 +0200
commit1ca9f7c3f7afac2af4c4c25b98426731f7e789c6 (patch)
tree27fe65c4ea5e9250d2523033d5c65b315bfca23d /server/models/video/video-channel.ts
parent0283eaac2a8e73006c66df3cf5bb9012e37450e5 (diff)
downloadPeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.tar.gz
PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.tar.zst
PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.zip
Type toFormattedJSON
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index b6a60827f..7a4df516a 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -37,7 +37,7 @@ import * as Bluebird from 'bluebird'
37import { 37import {
38 MChannelAccountDefault, 38 MChannelAccountDefault,
39 MChannelActor, 39 MChannelActor,
40 MChannelActorAccountDefaultVideos 40 MChannelActorAccountDefaultVideos, MChannelSummaryFormattable, MChannelFormattable
41} from '../../typings/models/video' 41} from '../../typings/models/video'
42 42
43// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation 43// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation
@@ -482,7 +482,20 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
482 .findByPk(id, options) 482 .findByPk(id, options)
483 } 483 }
484 484
485 toFormattedJSON (): VideoChannel { 485 toFormattedSummaryJSON (this: MChannelSummaryFormattable): VideoChannelSummary {
486 const actor = this.Actor.toFormattedSummaryJSON()
487
488 return {
489 id: this.id,
490 name: actor.name,
491 displayName: this.getDisplayName(),
492 url: actor.url,
493 host: actor.host,
494 avatar: actor.avatar
495 }
496 }
497
498 toFormattedJSON (this: MChannelFormattable): VideoChannel {
486 const actor = this.Actor.toFormattedJSON() 499 const actor = this.Actor.toFormattedJSON()
487 const videoChannel = { 500 const videoChannel = {
488 id: this.id, 501 id: this.id,
@@ -500,19 +513,6 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
500 return Object.assign(actor, videoChannel) 513 return Object.assign(actor, videoChannel)
501 } 514 }
502 515
503 toFormattedSummaryJSON (): VideoChannelSummary {
504 const actor = this.Actor.toFormattedJSON()
505
506 return {
507 id: this.id,
508 name: actor.name,
509 displayName: this.getDisplayName(),
510 url: actor.url,
511 host: actor.host,
512 avatar: actor.avatar
513 }
514 }
515
516 toActivityPubObject (): ActivityPubActor { 516 toActivityPubObject (): ActivityPubActor {
517 const obj = this.Actor.toActivityPubObject(this.name, 'VideoChannel') 517 const obj = this.Actor.toActivityPubObject(this.name, 'VideoChannel')
518 518