Fix overview endpoint
authorChocobozzz <me@florianbigard.com>
Wed, 24 Apr 2019 15:19:00 +0000 (17:19 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 24 Apr 2019 15:29:19 +0000 (17:29 +0200)
.travis.yml
server/middlewares/cache.ts
server/models/video/video.ts
server/tests/api/check-params/contact-form.ts
server/tests/api/videos/video-playlists.ts

index 8d61fc10f96bfea07dde02ea7d4a842003f5e1ad..5fa41fb43b16eab8adc0fcedbd2c717b16f28fb4 100644 (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
index e83d8d569bb3d107af0aec0ee41090a5d0d10d66..091c82d92cdad17f6e23ff94013120aee33e1791 100644 (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())
index 5fb529e8d113455c54c60b4413bb2802ca2bc252..4e6f602aa8bdfce12b4db4f9c4aab4ad5159ade6 100644 (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 = {
index 55004020fc256f445c94d6a26f13d3e096c2e84b..dbdd3a8a6830731e456ec80f4b43d69f6c822862 100644 (file)
@@ -87,6 +87,6 @@ describe('Test contact form API validators', function () {
   after(async function () {
     MockSmtpServer.Instance.kill()
 
-    // await cleanupTests([ server ])
+    await cleanupTests([ server ])
   })
 })
index 9285682999beac7c0d19e50f029a9f8311adf434..e4d817ff8b3784f03fac6b70752b78c757a7e7ef 100644 (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,