diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:45:05 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:45:05 +0200 |
commit | 980246ea8f1c51a137eaf0c441ef7e3b6fb88810 (patch) | |
tree | 0ce1339bc1d56a2dfd35935fe4f0303df8f75eca | |
parent | 8221fef0f9d9b426fa498840d3f4fe2abfe19788 (diff) | |
download | PeerTube-980246ea8f1c51a137eaf0c441ef7e3b6fb88810.tar.gz PeerTube-980246ea8f1c51a137eaf0c441ef7e3b6fb88810.tar.zst PeerTube-980246ea8f1c51a137eaf0c441ef7e3b6fb88810.zip |
Make tslint happy
-rw-r--r-- | client/src/app/shared/forms/form-validators/user.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/remote/videos.ts | 34 | ||||
-rw-r--r-- | server/initializers/constants.ts | 4 | ||||
-rw-r--r-- | server/lib/request/request-video-qadu-scheduler.ts | 30 | ||||
-rw-r--r-- | server/middlewares/validators/videos.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 1 |
6 files changed, 36 insertions, 37 deletions
diff --git a/client/src/app/shared/forms/form-validators/user.ts b/client/src/app/shared/forms/form-validators/user.ts index 087a99760..d4c4c1d33 100644 --- a/client/src/app/shared/forms/form-validators/user.ts +++ b/client/src/app/shared/forms/form-validators/user.ts | |||
@@ -28,4 +28,4 @@ export const USER_VIDEO_QUOTA = { | |||
28 | 'required': 'Video quota is required.', | 28 | 'required': 'Video quota is required.', |
29 | 'min': 'Quota must be greater than -1.' | 29 | 'min': 'Quota must be greater than -1.' |
30 | } | 30 | } |
31 | } \ No newline at end of file | 31 | } |
diff --git a/server/controllers/api/remote/videos.ts b/server/controllers/api/remote/videos.ts index 0a90549af..f7ee0356a 100644 --- a/server/controllers/api/remote/videos.ts +++ b/server/controllers/api/remote/videos.ts | |||
@@ -141,23 +141,23 @@ function processVideosEvents (eventData: RemoteVideoEventData, fromPod: PodInsta | |||
141 | let qaduType | 141 | let qaduType |
142 | 142 | ||
143 | switch (eventData.eventType) { | 143 | switch (eventData.eventType) { |
144 | case REQUEST_VIDEO_EVENT_TYPES.VIEWS: | 144 | case REQUEST_VIDEO_EVENT_TYPES.VIEWS: |
145 | columnToUpdate = 'views' | 145 | columnToUpdate = 'views' |
146 | qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS | 146 | qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS |
147 | break | 147 | break |
148 | 148 | ||
149 | case REQUEST_VIDEO_EVENT_TYPES.LIKES: | 149 | case REQUEST_VIDEO_EVENT_TYPES.LIKES: |
150 | columnToUpdate = 'likes' | 150 | columnToUpdate = 'likes' |
151 | qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES | 151 | qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES |
152 | break | 152 | break |
153 | 153 | ||
154 | case REQUEST_VIDEO_EVENT_TYPES.DISLIKES: | 154 | case REQUEST_VIDEO_EVENT_TYPES.DISLIKES: |
155 | columnToUpdate = 'dislikes' | 155 | columnToUpdate = 'dislikes' |
156 | qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES | 156 | qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES |
157 | break | 157 | break |
158 | 158 | ||
159 | default: | 159 | default: |
160 | throw new Error('Unknown video event type.') | 160 | throw new Error('Unknown video event type.') |
161 | } | 161 | } |
162 | 162 | ||
163 | const query = {} | 163 | const query = {} |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 2e3472d1e..e6af406e3 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -77,7 +77,7 @@ const CONFIG = { | |||
77 | }, | 77 | }, |
78 | SIGNUP: { | 78 | SIGNUP: { |
79 | ENABLED: config.get<boolean>('signup.enabled'), | 79 | ENABLED: config.get<boolean>('signup.enabled'), |
80 | LIMIT: config.get<number>('signup.limit'), | 80 | LIMIT: config.get<number>('signup.limit') |
81 | }, | 81 | }, |
82 | USER: { | 82 | USER: { |
83 | VIDEO_QUOTA: config.get<number>('user.video_quota') | 83 | VIDEO_QUOTA: config.get<number>('user.video_quota') |
@@ -298,7 +298,7 @@ let STATIC_MAX_AGE = '30d' | |||
298 | const THUMBNAILS_SIZE = '200x110' | 298 | const THUMBNAILS_SIZE = '200x110' |
299 | const PREVIEWS_SIZE = '640x480' | 299 | const PREVIEWS_SIZE = '640x480' |
300 | 300 | ||
301 | // Subfolders of cache directory | 301 | // Sub folders of cache directory |
302 | const CACHE = { | 302 | const CACHE = { |
303 | DIRECTORIES: { | 303 | DIRECTORIES: { |
304 | PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews') | 304 | PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews') |
diff --git a/server/lib/request/request-video-qadu-scheduler.ts b/server/lib/request/request-video-qadu-scheduler.ts index afb9d5c23..d7e1d5e31 100644 --- a/server/lib/request/request-video-qadu-scheduler.ts +++ b/server/lib/request/request-video-qadu-scheduler.ts | |||
@@ -81,21 +81,21 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa | |||
81 | if (!videoData) videoData = { uuid: null } | 81 | if (!videoData) videoData = { uuid: null } |
82 | 82 | ||
83 | switch (request.type) { | 83 | switch (request.type) { |
84 | case REQUEST_VIDEO_QADU_TYPES.LIKES: | 84 | case REQUEST_VIDEO_QADU_TYPES.LIKES: |
85 | videoData.likes = video.likes | 85 | videoData.likes = video.likes |
86 | break | 86 | break |
87 | 87 | ||
88 | case REQUEST_VIDEO_QADU_TYPES.DISLIKES: | 88 | case REQUEST_VIDEO_QADU_TYPES.DISLIKES: |
89 | videoData.dislikes = video.dislikes | 89 | videoData.dislikes = video.dislikes |
90 | break | 90 | break |
91 | 91 | ||
92 | case REQUEST_VIDEO_QADU_TYPES.VIEWS: | 92 | case REQUEST_VIDEO_QADU_TYPES.VIEWS: |
93 | videoData.views = video.views | 93 | videoData.views = video.views |
94 | break | 94 | break |
95 | 95 | ||
96 | default: | 96 | default: |
97 | logger.error('Unknown request video QADU type %s.', request.type) | 97 | logger.error('Unknown request video QADU type %s.', request.type) |
98 | return | 98 | return |
99 | } | 99 | } |
100 | 100 | ||
101 | // Do not forget the uuid so the remote pod can identify the video | 101 | // Do not forget the uuid so the remote pod can identify the video |
@@ -103,12 +103,12 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa | |||
103 | requestsToMakeGrouped[hashKey].ids.push(request.id) | 103 | requestsToMakeGrouped[hashKey].ids.push(request.id) |
104 | 104 | ||
105 | // Maybe there are multiple quick and dirty update for the same video | 105 | // Maybe there are multiple quick and dirty update for the same video |
106 | // We use this hashmap to dedupe them | 106 | // We use this hash map to dedupe them |
107 | requestsToMakeGrouped[hashKey].videos[video.id] = videoData | 107 | requestsToMakeGrouped[hashKey].videos[video.id] = videoData |
108 | }) | 108 | }) |
109 | }) | 109 | }) |
110 | 110 | ||
111 | // Now we deduped similar quick and dirty updates, we can build our requests datas | 111 | // Now we deduped similar quick and dirty updates, we can build our requests data |
112 | Object.keys(requestsToMakeGrouped).forEach(hashKey => { | 112 | Object.keys(requestsToMakeGrouped).forEach(hashKey => { |
113 | Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => { | 113 | Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => { |
114 | const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID] | 114 | const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID] |
@@ -118,7 +118,7 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa | |||
118 | }) | 118 | }) |
119 | }) | 119 | }) |
120 | 120 | ||
121 | // We don't need it anymore, it was just to build our datas array | 121 | // We don't need it anymore, it was just to build our data array |
122 | delete requestsToMakeGrouped[hashKey].videos | 122 | delete requestsToMakeGrouped[hashKey].videos |
123 | }) | 123 | }) |
124 | 124 | ||
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index 1d19ebfd9..576814fcb 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -39,7 +39,7 @@ function videosAddValidator (req: express.Request, res: express.Response, next: | |||
39 | }) | 39 | }) |
40 | .then(duration => { | 40 | .then(duration => { |
41 | // Previous test failed, abort | 41 | // Previous test failed, abort |
42 | if (duration === undefined) return | 42 | if (duration === undefined) return undefined |
43 | 43 | ||
44 | if (!isVideoDurationValid('' + duration)) { | 44 | if (!isVideoDurationValid('' + duration)) { |
45 | return res.status(400).send('Duration of the video file is too big (max: ' + CONSTRAINTS_FIELDS.VIDEOS.DURATION.max + 's).') | 45 | return res.status(400).send('Duration of the video file is too big (max: ' + CONSTRAINTS_FIELDS.VIDEOS.DURATION.max + 's).') |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 4fb4485d8..8c69fe189 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -9,7 +9,6 @@ import * as Sequelize from 'sequelize' | |||
9 | import * as Promise from 'bluebird' | 9 | import * as Promise from 'bluebird' |
10 | 10 | ||
11 | import { TagInstance } from './tag-interface' | 11 | import { TagInstance } from './tag-interface' |
12 | import { UserInstance } from '../user/user-interface' | ||
13 | import { | 12 | import { |
14 | logger, | 13 | logger, |
15 | isVideoNameValid, | 14 | isVideoNameValid, |