diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-22 16:25:03 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:53 +0100 |
commit | 40ff57078e15d5b86ee6b71e198b95d3feb78eaf (patch) | |
tree | 88031d4eac6a26597e8a1f2fc63674664e3eae26 /server/models/video/video.ts | |
parent | c46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (diff) | |
download | PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.gz PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.zst PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.zip |
Federate video views
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 9b411a92e..052fc0ae8 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -567,6 +567,14 @@ toActivityPubObject = function (this: VideoInstance) { | |||
567 | name: t.name | 567 | name: t.name |
568 | })) | 568 | })) |
569 | 569 | ||
570 | let language | ||
571 | if (this.language) { | ||
572 | language = { | ||
573 | identifier: this.language + '', | ||
574 | name: this.getLanguageLabel() | ||
575 | } | ||
576 | } | ||
577 | |||
570 | const url = [] | 578 | const url = [] |
571 | for (const file of this.VideoFiles) { | 579 | for (const file of this.VideoFiles) { |
572 | url.push({ | 580 | url.push({ |
@@ -608,10 +616,7 @@ toActivityPubObject = function (this: VideoInstance) { | |||
608 | identifier: this.licence + '', | 616 | identifier: this.licence + '', |
609 | name: this.getLicenceLabel() | 617 | name: this.getLicenceLabel() |
610 | }, | 618 | }, |
611 | language: { | 619 | language, |
612 | identifier: this.language + '', | ||
613 | name: this.getLanguageLabel() | ||
614 | }, | ||
615 | views: this.views, | 620 | views: this.views, |
616 | nsfw: this.nsfw, | 621 | nsfw: this.nsfw, |
617 | published: this.createdAt.toISOString(), | 622 | published: this.createdAt.toISOString(), |
@@ -816,7 +821,19 @@ listAllAndSharedByAccountForOutbox = function (accountId: number, start: number, | |||
816 | include: [ | 821 | include: [ |
817 | { | 822 | { |
818 | model: Video['sequelize'].models.VideoShare, | 823 | model: Video['sequelize'].models.VideoShare, |
819 | required: false | 824 | required: false, |
825 | where: { | ||
826 | [Sequelize.Op.and]: [ | ||
827 | { | ||
828 | id: { | ||
829 | [Sequelize.Op.not]: null | ||
830 | } | ||
831 | }, | ||
832 | { | ||
833 | accountId | ||
834 | } | ||
835 | ] | ||
836 | } | ||
820 | }, | 837 | }, |
821 | { | 838 | { |
822 | model: Video['sequelize'].models.VideoChannel, | 839 | model: Video['sequelize'].models.VideoChannel, |