diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-10 14:48:08 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 38fa2065831b5f55be0d7f30f19a62c967397208 (patch) | |
tree | 4a986465e3a88c85bc6a8b5fc992e0f2edd63ef0 /server/middlewares/validators/videos.ts | |
parent | 0d0e8dd0904b380b70e19ebcb4763d65601c4632 (diff) | |
download | PeerTube-38fa2065831b5f55be0d7f30f19a62c967397208.tar.gz PeerTube-38fa2065831b5f55be0d7f30f19a62c967397208.tar.zst PeerTube-38fa2065831b5f55be0d7f30f19a62c967397208.zip |
Remove references to author
Diffstat (limited to 'server/middlewares/validators/videos.ts')
-rw-r--r-- | server/middlewares/validators/videos.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index 15b4629c1..10b426df3 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -48,11 +48,11 @@ const videosAddValidator = [ | |||
48 | const videoFile: Express.Multer.File = req.files['videofile'][0] | 48 | const videoFile: Express.Multer.File = req.files['videofile'][0] |
49 | const user = res.locals.oauth.token.User | 49 | const user = res.locals.oauth.token.User |
50 | 50 | ||
51 | return db.VideoChannel.loadByIdAndAuthor(req.body.channelId, user.Author.id) | 51 | return db.VideoChannel.loadByIdAndAccount(req.body.channelId, user.Account.id) |
52 | .then(videoChannel => { | 52 | .then(videoChannel => { |
53 | if (!videoChannel) { | 53 | if (!videoChannel) { |
54 | res.status(400) | 54 | res.status(400) |
55 | .json({ error: 'Unknown video video channel for this author.' }) | 55 | .json({ error: 'Unknown video video channel for this account.' }) |
56 | .end() | 56 | .end() |
57 | 57 | ||
58 | return undefined | 58 | return undefined |
@@ -131,7 +131,7 @@ const videosUpdateValidator = [ | |||
131 | .end() | 131 | .end() |
132 | } | 132 | } |
133 | 133 | ||
134 | if (video.VideoChannel.Author.userId !== res.locals.oauth.token.User.id) { | 134 | if (video.VideoChannel.Account.userId !== res.locals.oauth.token.User.id) { |
135 | return res.status(403) | 135 | return res.status(403) |
136 | .json({ error: 'Cannot update video of another user' }) | 136 | .json({ error: 'Cannot update video of another user' }) |
137 | .end() | 137 | .end() |
@@ -163,7 +163,7 @@ const videosGetValidator = [ | |||
163 | if (video.privacy !== VideoPrivacy.PRIVATE) return next() | 163 | if (video.privacy !== VideoPrivacy.PRIVATE) return next() |
164 | 164 | ||
165 | authenticate(req, res, () => { | 165 | authenticate(req, res, () => { |
166 | if (video.VideoChannel.Author.userId !== res.locals.oauth.token.User.id) { | 166 | if (video.VideoChannel.Account.userId !== res.locals.oauth.token.User.id) { |
167 | return res.status(403) | 167 | return res.status(403) |
168 | .json({ error: 'Cannot get this private video of another user' }) | 168 | .json({ error: 'Cannot get this private video of another user' }) |
169 | .end() | 169 | .end() |
@@ -256,10 +256,10 @@ function checkUserCanDeleteVideo (userId: number, res: express.Response, callbac | |||
256 | 256 | ||
257 | // Check if the user can delete the video | 257 | // Check if the user can delete the video |
258 | // The user can delete it if s/he is an admin | 258 | // The user can delete it if s/he is an admin |
259 | // Or if s/he is the video's author | 259 | // Or if s/he is the video's account |
260 | const author = res.locals.video.VideoChannel.Author | 260 | const account = res.locals.video.VideoChannel.Account |
261 | const user = res.locals.oauth.token.User | 261 | const user = res.locals.oauth.token.User |
262 | if (user.hasRight(UserRight.REMOVE_ANY_VIDEO) === false && author.userId !== user.id) { | 262 | if (user.hasRight(UserRight.REMOVE_ANY_VIDEO) === false && account.userId !== user.id) { |
263 | return res.status(403) | 263 | return res.status(403) |
264 | .json({ error: 'Cannot remove video of another user' }) | 264 | .json({ error: 'Cannot remove video of another user' }) |
265 | .end() | 265 | .end() |