aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-07 15:08:12 +0100
committerChocobozzz <me@florianbigard.com>2020-12-07 16:07:52 +0100
commit17b7d4b315ee958acd52d27d0bc4133164bca254 (patch)
tree719b7812e126f81c1e8a0da4e6e77695b7894294
parent8e0a2f2a05df23c30abb21cfbd540fc289c33b91 (diff)
downloadPeerTube-17b7d4b315ee958acd52d27d0bc4133164bca254.tar.gz
PeerTube-17b7d4b315ee958acd52d27d0bc4133164bca254.tar.zst
PeerTube-17b7d4b315ee958acd52d27d0bc4133164bca254.zip
Don't allow manual redundancy of live videos
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts2
-rw-r--r--server/middlewares/validators/redundancy.ts8
2 files changed, 7 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 321f7b09f..3c2b46d16 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -167,7 +167,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
167 } 167 }
168 168
169 canVideoBeDuplicated () { 169 canVideoBeDuplicated () {
170 return this.video.canBeDuplicatedBy(this.user) 170 return !this.video.isLive && this.video.canBeDuplicatedBy(this.user)
171 } 171 }
172 172
173 isVideoAccountMutable () { 173 isVideoAccountMutable () {
diff --git a/server/middlewares/validators/redundancy.ts b/server/middlewares/validators/redundancy.ts
index 6d2dd39c9..c379aebe4 100644
--- a/server/middlewares/validators/redundancy.ts
+++ b/server/middlewares/validators/redundancy.ts
@@ -130,8 +130,12 @@ const addVideoRedundancyValidator = [
130 130
131 if (res.locals.onlyVideo.remote === false) { 131 if (res.locals.onlyVideo.remote === false) {
132 return res.status(HttpStatusCode.BAD_REQUEST_400) 132 return res.status(HttpStatusCode.BAD_REQUEST_400)
133 .json({ error: 'Cannot create a redundancy on a local video' }) 133 .json({ error: 'Cannot create a redundancy on a local video' })
134 .end() 134 }
135
136 if (res.locals.onlyVideo.isLive) {
137 return res.status(HttpStatusCode.BAD_REQUEST_400)
138 .json({ error: 'Cannot create a redundancy of a live video' })
135 } 139 }
136 140
137 const alreadyExists = await VideoRedundancyModel.isLocalByVideoUUIDExists(res.locals.onlyVideo.uuid) 141 const alreadyExists = await VideoRedundancyModel.isLocalByVideoUUIDExists(res.locals.onlyVideo.uuid)