From 98ec8b8e73a918d5680e6f13aaef56ca8756c2a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Nov 2017 13:16:23 +0100 Subject: Fix lint --- server/controllers/activitypub/client.ts | 4 ++-- server/controllers/activitypub/outbox.ts | 7 ++++--- server/lib/activitypub/send/send-delete.ts | 2 +- server/middlewares/validators/video-channels.ts | 2 +- server/middlewares/validators/videos.ts | 2 +- server/models/video/video-channel-share-interface.ts | 5 ++--- server/models/video/video-share-interface.ts | 5 ++--- server/tests/client.ts | 11 +++++++---- server/tests/index.ts | 1 + server/tests/utils/index.ts | 1 + 10 files changed, 22 insertions(+), 18 deletions(-) (limited to 'server') diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 62cde1fc7..a478acd14 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts @@ -73,7 +73,7 @@ async function accountFollowersController (req: express.Request, res: express.Re const page = req.query.page || 1 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) - const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], start, count) + const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], undefined, start, count) const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result) return res.json(activityPubResult) @@ -85,7 +85,7 @@ async function accountFollowingController (req: express.Request, res: express.Re const page = req.query.page || 1 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) - const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], start, count) + const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], undefined, start, count) const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result) return res.json(activityPubResult) diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts index e2c4e9b1e..5a2d43f3d 100644 --- a/server/controllers/activitypub/outbox.ts +++ b/server/controllers/activitypub/outbox.ts @@ -38,15 +38,16 @@ async function outboxController (req: express.Request, res: express.Response, ne const videoObject = video.toActivityPubObject() // This is a shared video + const videoChannel = video.VideoChannel if (video.VideoShares !== undefined && video.VideoShares.length !== 0) { - const addActivity = await addActivityData(video.url, video.VideoChannel.Account, video, video.VideoChannel.url, videoObject) + const addActivity = await addActivityData(video.url, videoChannel.Account, video, videoChannel.url, videoObject, undefined) const url = getAnnounceActivityPubUrl(video.url, account) - const announceActivity = await announceActivityData(url, account, addActivity) + const announceActivity = await announceActivityData(url, account, addActivity, undefined) activities.push(announceActivity) } else { - const addActivity = await addActivityData(video.url, account, video, video.VideoChannel.url, videoObject) + const addActivity = await addActivityData(video.url, account, video, videoChannel.url, videoObject, undefined) activities.push(addActivity) } diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index c49cda04f..8193790b3 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts @@ -27,7 +27,7 @@ async function sendDeleteVideo (video: VideoInstance, t: Transaction) { } async function sendDeleteAccount (account: AccountInstance, t: Transaction) { - const data = await deleteActivityData(account.url, account) + const data = deleteActivityData(account.url, account) return broadcastToFollowers(data, account, [ account ], t) } diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts index 4683c91e1..3d31a7e52 100644 --- a/server/middlewares/validators/video-channels.ts +++ b/server/middlewares/validators/video-channels.ts @@ -109,7 +109,7 @@ const videoChannelsShareValidator = [ if (areValidationErrors(req, res)) return if (!await isVideoChannelExist(req.params.id, res)) return - const share = await db.VideoChannelShare.load(res.locals.video.id, req.params.accountId) + const share = await db.VideoChannelShare.load(res.locals.video.id, req.params.accountId, undefined) if (!share) { return res.status(404) .end() diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index 52b4475ce..f21680aa0 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts @@ -222,7 +222,7 @@ const videosShareValidator = [ if (areValidationErrors(req, res)) return if (!await isVideoExist(req.params.id, res)) return - const share = await db.VideoShare.load(req.params.accountId, res.locals.video.id) + const share = await db.VideoShare.load(req.params.accountId, res.locals.video.id, undefined) if (!share) { return res.status(404) .end() diff --git a/server/models/video/video-channel-share-interface.ts b/server/models/video/video-channel-share-interface.ts index 0482e8297..2fff41a1b 100644 --- a/server/models/video/video-channel-share-interface.ts +++ b/server/models/video/video-channel-share-interface.ts @@ -1,12 +1,11 @@ import * as Bluebird from 'bluebird' import * as Sequelize from 'sequelize' -import { Transaction } from 'sequelize' import { AccountInstance } from '../account/account-interface' import { VideoChannelInstance } from './video-channel-interface' export namespace VideoChannelShareMethods { - export type LoadAccountsByShare = (videoChannelId: number, t: Transaction) => Bluebird - export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird + export type LoadAccountsByShare = (videoChannelId: number, t: Sequelize.Transaction) => Bluebird + export type Load = (accountId: number, videoId: number, t: Sequelize.Transaction) => Bluebird } export interface VideoChannelShareClass { diff --git a/server/models/video/video-share-interface.ts b/server/models/video/video-share-interface.ts index 8ad10e095..3946303f1 100644 --- a/server/models/video/video-share-interface.ts +++ b/server/models/video/video-share-interface.ts @@ -1,12 +1,11 @@ import * as Bluebird from 'bluebird' import * as Sequelize from 'sequelize' -import { Transaction } from 'sequelize' import { AccountInstance } from '../account/account-interface' import { VideoInstance } from './video-interface' export namespace VideoShareMethods { - export type LoadAccountsByShare = (videoId: number, t: Transaction) => Bluebird - export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird + export type LoadAccountsByShare = (videoId: number, t: Sequelize.Transaction) => Bluebird + export type Load = (accountId: number, videoId: number, t: Sequelize.Transaction) => Bluebird } export interface VideoShareClass { diff --git a/server/tests/client.ts b/server/tests/client.ts index 0d70e3451..8c4334c53 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts @@ -41,8 +41,9 @@ describe('Test a client controllers', function () { it('Should have valid Open Graph tags on the watch page with video id', async function () { const res = await request(server.url) - .get('/videos/watch/' + server.video.id) - .expect(200) + .get('/videos/watch/' + server.video.id) + .set('Accept', 'text/html') + .expect(200) expect(res.text).to.contain('') expect(res.text).to.contain('') @@ -50,8 +51,9 @@ describe('Test a client controllers', function () { it('Should have valid Open Graph tags on the watch page with video uuid', async function () { const res = await request(server.url) - .get('/videos/watch/' + server.video.uuid) - .expect(200) + .get('/videos/watch/' + server.video.uuid) + .set('Accept', 'text/html') + .expect(200) expect(res.text).to.contain('') expect(res.text).to.contain('') @@ -61,6 +63,7 @@ describe('Test a client controllers', function () { const path = '/videos/watch/' + server.video.uuid const res = await request(server.url) .get(path) + .set('Accept', 'text/html') .expect(200) const expectedLink = '