aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-22 16:25:03 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit40ff57078e15d5b86ee6b71e198b95d3feb78eaf (patch)
tree88031d4eac6a26597e8a1f2fc63674664e3eae26 /server/models/video
parentc46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (diff)
downloadPeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.gz
PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.zst
PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.zip
Federate video views
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-interface.ts2
-rw-r--r--server/models/video/video.ts27
2 files changed, 23 insertions, 6 deletions
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts
index 391ecff43..b97f163ab 100644
--- a/server/models/video/video-interface.ts
+++ b/server/models/video/video-interface.ts
@@ -122,7 +122,7 @@ export interface VideoAttributes {
122 VideoChannel?: VideoChannelInstance 122 VideoChannel?: VideoChannelInstance
123 Tags?: TagInstance[] 123 Tags?: TagInstance[]
124 VideoFiles?: VideoFileInstance[] 124 VideoFiles?: VideoFileInstance[]
125 VideoShare?: VideoShareInstance 125 VideoShares?: VideoShareInstance[]
126} 126}
127 127
128export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { 128export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
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,