Fix overview endpoint

pull/1787/head
Chocobozzz 2019-04-24 17:19:00 +02:00
parent 9ce3d3027e
commit 8519cc9234
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 17 additions and 10 deletions

View File

@ -47,7 +47,7 @@ matrix:
- env: TEST_SUITE=lint - env: TEST_SUITE=lint
script: script:
- NODE_PENDING_JOB_WAIT=1000 travis_retry npm run travis -- "$TEST_SUITE" - NODE_PENDING_JOB_WAIT=2000 travis_retry npm run travis -- "$TEST_SUITE"
after_failure: after_failure:
- cat test1/logs/peertube.log - cat test1/logs/peertube.log

View File

@ -7,6 +7,8 @@ import { logger } from '../helpers/logger'
const lock = new AsyncLock({ timeout: 5000 }) const lock = new AsyncLock({ timeout: 5000 })
function cacheRoute (lifetimeArg: string | number) { function cacheRoute (lifetimeArg: string | number) {
const lifetime = parseDurationToMs(lifetimeArg)
return async function (req: express.Request, res: express.Response, next: express.NextFunction) { return async function (req: express.Request, res: express.Response, next: express.NextFunction) {
const redisKey = Redis.Instance.generateCachedRouteKey(req) const redisKey = Redis.Instance.generateCachedRouteKey(req)
@ -24,7 +26,6 @@ function cacheRoute (lifetimeArg: string | number) {
res.send = (body) => { res.send = (body) => {
if (res.statusCode >= 200 && res.statusCode < 400) { if (res.statusCode >= 200 && res.statusCode < 400) {
const contentType = res.get('content-type') const contentType = res.get('content-type')
const lifetime = parseDurationToMs(lifetimeArg)
Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode) Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode)
.then(() => done()) .then(() => done())

View File

@ -207,6 +207,8 @@ type AvailableForListIDsOptions = {
followerActorId: number followerActorId: number
includeLocalVideos: boolean includeLocalVideos: boolean
withoutId?: boolean
filter?: VideoFilter filter?: VideoFilter
categoryOneOf?: number[] categoryOneOf?: number[]
nsfw?: boolean nsfw?: boolean
@ -268,9 +270,11 @@ type AvailableForListIDsOptions = {
return query return query
}, },
[ ScopeNames.AVAILABLE_FOR_LIST_IDS ]: (options: AvailableForListIDsOptions) => { [ ScopeNames.AVAILABLE_FOR_LIST_IDS ]: (options: AvailableForListIDsOptions) => {
const attributes = options.withoutId === true ? [] : [ 'id' ]
const query: FindOptions = { const query: FindOptions = {
raw: true, raw: true,
attributes: [ 'id' ], attributes,
where: { where: {
id: { id: {
[ Op.and ]: [ [ Op.and ]: [
@ -1523,7 +1527,8 @@ export class VideoModel extends Model<VideoModel> {
const scopeOptions: AvailableForListIDsOptions = { const scopeOptions: AvailableForListIDsOptions = {
serverAccountId: serverActor.Account.id, serverAccountId: serverActor.Account.id,
followerActorId, followerActorId,
includeLocalVideos: true includeLocalVideos: true,
withoutId: true // Don't break aggregation
} }
const query: FindOptions = { const query: FindOptions = {

View File

@ -87,6 +87,6 @@ describe('Test contact form API validators', function () {
after(async function () { after(async function () {
MockSmtpServer.Instance.kill() MockSmtpServer.Instance.kill()
// await cleanupTests([ server ]) await cleanupTests([ server ])
}) })
}) })

View File

@ -5,23 +5,24 @@ import 'mocha'
import { import {
addVideoChannel, addVideoChannel,
addVideoInPlaylist, addVideoInPlaylist,
checkPlaylistFilesWereRemoved, cleanupTests, checkPlaylistFilesWereRemoved,
cleanupTests,
createUser, createUser,
createVideoPlaylist, createVideoPlaylist,
deleteVideoChannel, deleteVideoChannel,
deleteVideoPlaylist, deleteVideoPlaylist,
doubleFollow, doVideosExistInMyPlaylist, doubleFollow,
doVideosExistInMyPlaylist,
flushAndRunMultipleServers, flushAndRunMultipleServers,
flushTests,
getAccountPlaylistsList, getAccountPlaylistsList,
getAccountPlaylistsListWithToken, getMyUserInformation, getAccountPlaylistsListWithToken,
getMyUserInformation,
getPlaylistVideos, getPlaylistVideos,
getVideoChannelPlaylistsList, getVideoChannelPlaylistsList,
getVideoPlaylist, getVideoPlaylist,
getVideoPlaylistPrivacies, getVideoPlaylistPrivacies,
getVideoPlaylistsList, getVideoPlaylistsList,
getVideoPlaylistWithToken, getVideoPlaylistWithToken,
killallServers,
removeUser, removeUser,
removeVideoFromPlaylist, removeVideoFromPlaylist,
reorderVideosPlaylist, reorderVideosPlaylist,