diff options
Diffstat (limited to 'server/controllers/api/users/index.ts')
-rw-r--r-- | server/controllers/api/users/index.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 5b113feac..d743a9912 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -52,6 +52,7 @@ import { myVideosHistoryRouter } from './my-history' | |||
52 | import { myNotificationsRouter } from './my-notifications' | 52 | import { myNotificationsRouter } from './my-notifications' |
53 | import { mySubscriptionsRouter } from './my-subscriptions' | 53 | import { mySubscriptionsRouter } from './my-subscriptions' |
54 | import { myVideoPlaylistsRouter } from './my-video-playlists' | 54 | import { myVideoPlaylistsRouter } from './my-video-playlists' |
55 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
55 | 56 | ||
56 | const auditLogger = auditLoggerFactory('users') | 57 | const auditLogger = auditLoggerFactory('users') |
57 | 58 | ||
@@ -255,7 +256,7 @@ async function registerUser (req: express.Request, res: express.Response) { | |||
255 | 256 | ||
256 | Hooks.runAction('action:api.user.registered', { body, user, account, videoChannel }) | 257 | Hooks.runAction('action:api.user.registered', { body, user, account, videoChannel }) |
257 | 258 | ||
258 | return res.type('json').status(204).end() | 259 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
259 | } | 260 | } |
260 | 261 | ||
261 | async function unblockUser (req: express.Request, res: express.Response) { | 262 | async function unblockUser (req: express.Request, res: express.Response) { |
@@ -265,7 +266,7 @@ async function unblockUser (req: express.Request, res: express.Response) { | |||
265 | 266 | ||
266 | Hooks.runAction('action:api.user.unblocked', { user }) | 267 | Hooks.runAction('action:api.user.unblocked', { user }) |
267 | 268 | ||
268 | return res.status(204).end() | 269 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
269 | } | 270 | } |
270 | 271 | ||
271 | async function blockUser (req: express.Request, res: express.Response) { | 272 | async function blockUser (req: express.Request, res: express.Response) { |
@@ -276,7 +277,7 @@ async function blockUser (req: express.Request, res: express.Response) { | |||
276 | 277 | ||
277 | Hooks.runAction('action:api.user.blocked', { user }) | 278 | Hooks.runAction('action:api.user.blocked', { user }) |
278 | 279 | ||
279 | return res.status(204).end() | 280 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
280 | } | 281 | } |
281 | 282 | ||
282 | function getUser (req: express.Request, res: express.Response) { | 283 | function getUser (req: express.Request, res: express.Response) { |
@@ -310,7 +311,7 @@ async function removeUser (req: express.Request, res: express.Response) { | |||
310 | 311 | ||
311 | Hooks.runAction('action:api.user.deleted', { user }) | 312 | Hooks.runAction('action:api.user.deleted', { user }) |
312 | 313 | ||
313 | return res.sendStatus(204) | 314 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
314 | } | 315 | } |
315 | 316 | ||
316 | async function updateUser (req: express.Request, res: express.Response) { | 317 | async function updateUser (req: express.Request, res: express.Response) { |
@@ -338,7 +339,7 @@ async function updateUser (req: express.Request, res: express.Response) { | |||
338 | 339 | ||
339 | // Don't need to send this update to followers, these attributes are not federated | 340 | // Don't need to send this update to followers, these attributes are not federated |
340 | 341 | ||
341 | return res.sendStatus(204) | 342 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
342 | } | 343 | } |
343 | 344 | ||
344 | async function askResetUserPassword (req: express.Request, res: express.Response) { | 345 | async function askResetUserPassword (req: express.Request, res: express.Response) { |
@@ -348,7 +349,7 @@ async function askResetUserPassword (req: express.Request, res: express.Response | |||
348 | const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString | 349 | const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString |
349 | await Emailer.Instance.addPasswordResetEmailJob(user.username, user.email, url) | 350 | await Emailer.Instance.addPasswordResetEmailJob(user.username, user.email, url) |
350 | 351 | ||
351 | return res.status(204).end() | 352 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
352 | } | 353 | } |
353 | 354 | ||
354 | async function resetUserPassword (req: express.Request, res: express.Response) { | 355 | async function resetUserPassword (req: express.Request, res: express.Response) { |
@@ -358,7 +359,7 @@ async function resetUserPassword (req: express.Request, res: express.Response) { | |||
358 | await user.save() | 359 | await user.save() |
359 | await Redis.Instance.removePasswordVerificationString(user.id) | 360 | await Redis.Instance.removePasswordVerificationString(user.id) |
360 | 361 | ||
361 | return res.status(204).end() | 362 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
362 | } | 363 | } |
363 | 364 | ||
364 | async function reSendVerifyUserEmail (req: express.Request, res: express.Response) { | 365 | async function reSendVerifyUserEmail (req: express.Request, res: express.Response) { |
@@ -366,7 +367,7 @@ async function reSendVerifyUserEmail (req: express.Request, res: express.Respons | |||
366 | 367 | ||
367 | await sendVerifyUserEmail(user) | 368 | await sendVerifyUserEmail(user) |
368 | 369 | ||
369 | return res.status(204).end() | 370 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
370 | } | 371 | } |
371 | 372 | ||
372 | async function verifyUserEmail (req: express.Request, res: express.Response) { | 373 | async function verifyUserEmail (req: express.Request, res: express.Response) { |
@@ -380,7 +381,7 @@ async function verifyUserEmail (req: express.Request, res: express.Response) { | |||
380 | 381 | ||
381 | await user.save() | 382 | await user.save() |
382 | 383 | ||
383 | return res.status(204).end() | 384 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
384 | } | 385 | } |
385 | 386 | ||
386 | async function changeUserBlock (res: express.Response, user: MUserAccountDefault, block: boolean, reason?: string) { | 387 | async function changeUserBlock (res: express.Response, user: MUserAccountDefault, block: boolean, reason?: string) { |