From 40ff57078e15d5b86ee6b71e198b95d3feb78eaf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 22 Nov 2017 16:25:03 +0100 Subject: Federate video views --- server/models/video/video.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'server/models/video/video.ts') 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) { name: t.name })) + let language + if (this.language) { + language = { + identifier: this.language + '', + name: this.getLanguageLabel() + } + } + const url = [] for (const file of this.VideoFiles) { url.push({ @@ -608,10 +616,7 @@ toActivityPubObject = function (this: VideoInstance) { identifier: this.licence + '', name: this.getLicenceLabel() }, - language: { - identifier: this.language + '', - name: this.getLanguageLabel() - }, + language, views: this.views, nsfw: this.nsfw, published: this.createdAt.toISOString(), @@ -816,7 +821,19 @@ listAllAndSharedByAccountForOutbox = function (accountId: number, start: number, include: [ { model: Video['sequelize'].models.VideoShare, - required: false + required: false, + where: { + [Sequelize.Op.and]: [ + { + id: { + [Sequelize.Op.not]: null + } + }, + { + accountId + } + ] + } }, { model: Video['sequelize'].models.VideoChannel, -- cgit v1.2.3