1
0
Fork 0

Fix overview endpoint

This commit is contained in:
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
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:
- cat test1/logs/peertube.log

View file

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

View file

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

View file

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

View file

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