Client: avoid "quit friends" to appear during the pending request
authorChocobozzz <florian.bigard@gmail.com>
Fri, 21 Oct 2016 10:28:32 +0000 (12:28 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 21 Oct 2016 11:13:49 +0000 (13:13 +0200)
client/src/app/admin/friends/friend-list/friend-list.component.html
server.js
server/initializers/constants.js

index d786a78469ee612bc3d13f9094f50b5ba44373fe..20b4d12db5a95a081ab71f48007b04c50253680a 100644 (file)
@@ -20,7 +20,7 @@
   </tbody>
 </table>
 
-<a *ngIf="friends?.length !== 0" class="add-user btn btn-danger pull-left" (click)="quitFriends()">
+<a *ngIf="friends && friends.length !== 0" class="add-user btn btn-danger pull-left" (click)="quitFriends()">
   Quit friends
 </a>
 
index f24b25f4d96fc1501c38349563ef6d56fe75bcd1..d540c301b5213f87d4d80c0195e52acef86b1390 100644 (file)
--- a/server.js
+++ b/server.js
@@ -68,22 +68,22 @@ const apiRoute = '/api/' + constants.API_VERSION
 app.use(apiRoute, routes.api)
 
 // Static files
-app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: 0 }))
+app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE }))
 // 404 for static files not found
 app.use('/client/*', function (req, res, next) {
   res.sendStatus(404)
 })
 
 const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents'))
-app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: '7d' }))
+app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
 
 // Videos path for webseeding
 const videosPhysicalPath = path.join(__dirname, config.get('storage.videos'))
-app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: '7d' }))
+app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
 
 // Thumbnails path for express
 const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails'))
-app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: '7d' }))
+app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
 
 // Client application
 app.use('/*', function (req, res, next) {
index f77c4948fe5f39b56f4422767be620a9b8b7094e..8a8d5c1ce562ad7986dedd7042d37aecc3f07c44 100644 (file)
@@ -128,6 +128,9 @@ const STATIC_PATHS = {
   WEBSEED: '/static/webseed/'
 }
 
+// Cache control
+let STATIC_MAX_AGE = '30d'
+
 // Videos thumbnail size
 const THUMBNAILS_SIZE = '200x110'
 
@@ -143,6 +146,7 @@ if (isTestInstance() === true) {
   CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14
   FRIEND_SCORE.BASE = 20
   REQUESTS_INTERVAL = 10000
+  STATIC_MAX_AGE = 0
 }
 
 // ---------------------------------------------------------------------------
@@ -164,6 +168,7 @@ module.exports = {
   RETRY_REQUESTS,
   SEARCHABLE_COLUMNS,
   SORTABLE_COLUMNS,
+  STATIC_MAX_AGE,
   STATIC_PATHS,
   THUMBNAILS_SIZE,
   USER_ROLES