diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/controllers/api/videos/ownership.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/controllers/api/videos/ownership.ts')
-rw-r--r-- | server/controllers/api/videos/ownership.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts index d76fee51d..86adb6c69 100644 --- a/server/controllers/api/videos/ownership.ts +++ b/server/controllers/api/videos/ownership.ts | |||
@@ -19,6 +19,7 @@ import { changeVideoChannelShare } from '../../../lib/activitypub/share' | |||
19 | import { sendUpdateVideo } from '../../../lib/activitypub/send' | 19 | import { sendUpdateVideo } from '../../../lib/activitypub/send' |
20 | import { VideoModel } from '../../../models/video/video' | 20 | import { VideoModel } from '../../../models/video/video' |
21 | import { MVideoFullLight } from '@server/types/models' | 21 | import { MVideoFullLight } from '@server/types/models' |
22 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
22 | 23 | ||
23 | const ownershipVideoRouter = express.Router() | 24 | const ownershipVideoRouter = express.Router() |
24 | 25 | ||
@@ -80,7 +81,9 @@ async function giveVideoOwnership (req: express.Request, res: express.Response) | |||
80 | }) | 81 | }) |
81 | 82 | ||
82 | logger.info('Ownership change for video %s created.', videoInstance.name) | 83 | logger.info('Ownership change for video %s created.', videoInstance.name) |
83 | return res.type('json').status(204).end() | 84 | return res.type('json') |
85 | .status(HttpStatusCode.NO_CONTENT_204) | ||
86 | .end() | ||
84 | } | 87 | } |
85 | 88 | ||
86 | async function listVideoOwnership (req: express.Request, res: express.Response) { | 89 | async function listVideoOwnership (req: express.Request, res: express.Response) { |
@@ -119,7 +122,7 @@ async function acceptOwnership (req: express.Request, res: express.Response) { | |||
119 | videoChangeOwnership.status = VideoChangeOwnershipStatus.ACCEPTED | 122 | videoChangeOwnership.status = VideoChangeOwnershipStatus.ACCEPTED |
120 | await videoChangeOwnership.save({ transaction: t }) | 123 | await videoChangeOwnership.save({ transaction: t }) |
121 | 124 | ||
122 | return res.sendStatus(204) | 125 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
123 | }) | 126 | }) |
124 | } | 127 | } |
125 | 128 | ||
@@ -130,6 +133,6 @@ async function refuseOwnership (req: express.Request, res: express.Response) { | |||
130 | videoChangeOwnership.status = VideoChangeOwnershipStatus.REFUSED | 133 | videoChangeOwnership.status = VideoChangeOwnershipStatus.REFUSED |
131 | await videoChangeOwnership.save({ transaction: t }) | 134 | await videoChangeOwnership.save({ transaction: t }) |
132 | 135 | ||
133 | return res.sendStatus(204) | 136 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
134 | }) | 137 | }) |
135 | } | 138 | } |