diff options
author | Chocobozzz <me@florianbigard.com> | 2022-02-11 10:51:33 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-02-28 10:42:19 +0100 |
commit | c729caf6cc34630877a0e5a1bda1719384cd0c8a (patch) | |
tree | 1d2e13722e518c73d2c9e6f0969615e29d51cf8c /server/middlewares/validators/videos/video-ownership-changes.ts | |
parent | a24bf4dc659cebb65d887862bf21d7a35e9ec791 (diff) | |
download | PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.tar.gz PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.tar.zst PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.zip |
Add basic video editor support
Diffstat (limited to 'server/middlewares/validators/videos/video-ownership-changes.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-ownership-changes.ts | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts index 95e4cebce..6dcdc05f5 100644 --- a/server/middlewares/validators/videos/video-ownership-changes.ts +++ b/server/middlewares/validators/videos/video-ownership-changes.ts | |||
@@ -3,20 +3,13 @@ import { param } from 'express-validator' | |||
3 | import { isIdValid } from '@server/helpers/custom-validators/misc' | 3 | import { isIdValid } from '@server/helpers/custom-validators/misc' |
4 | import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership' | 4 | import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership' |
5 | import { logger } from '@server/helpers/logger' | 5 | import { logger } from '@server/helpers/logger' |
6 | import { isAbleToUploadVideo } from '@server/lib/user' | ||
7 | import { AccountModel } from '@server/models/account/account' | 6 | import { AccountModel } from '@server/models/account/account' |
8 | import { MVideoWithAllFiles } from '@server/types/models' | 7 | import { MVideoWithAllFiles } from '@server/types/models' |
9 | import { | 8 | import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' |
10 | HttpStatusCode, | ||
11 | ServerErrorCode, | ||
12 | UserRight, | ||
13 | VideoChangeOwnershipAccept, | ||
14 | VideoChangeOwnershipStatus, | ||
15 | VideoState | ||
16 | } from '@shared/models' | ||
17 | import { | 9 | import { |
18 | areValidationErrors, | 10 | areValidationErrors, |
19 | checkUserCanManageVideo, | 11 | checkUserCanManageVideo, |
12 | checkUserQuota, | ||
20 | doesChangeVideoOwnershipExist, | 13 | doesChangeVideoOwnershipExist, |
21 | doesVideoChannelOfAccountExist, | 14 | doesVideoChannelOfAccountExist, |
22 | doesVideoExist, | 15 | doesVideoExist, |
@@ -113,15 +106,7 @@ async function checkCanAccept (video: MVideoWithAllFiles, res: express.Response) | |||
113 | 106 | ||
114 | const user = res.locals.oauth.token.User | 107 | const user = res.locals.oauth.token.User |
115 | 108 | ||
116 | if (!await isAbleToUploadVideo(user.id, video.getMaxQualityFile().size)) { | 109 | if (!await checkUserQuota(user, video.getMaxQualityFile().size, res)) return false |
117 | res.fail({ | ||
118 | status: HttpStatusCode.PAYLOAD_TOO_LARGE_413, | ||
119 | message: 'The user video quota is exceeded with this video.', | ||
120 | type: ServerErrorCode.QUOTA_REACHED | ||
121 | }) | ||
122 | |||
123 | return false | ||
124 | } | ||
125 | 110 | ||
126 | return true | 111 | return true |
127 | } | 112 | } |