diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-18 16:31:12 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-18 16:31:12 +0100 |
commit | 22e909224c023c10699fce5c8b9db4be2cd049d7 (patch) | |
tree | c11544c5c504c345f4ca5981a496937e97276625 /client/src/app | |
parent | 68e72ba90c35fc7922e10b221f513ef711b35353 (diff) | |
download | PeerTube-22e909224c023c10699fce5c8b9db4be2cd049d7.tar.gz PeerTube-22e909224c023c10699fce5c8b9db4be2cd049d7.tar.zst PeerTube-22e909224c023c10699fce5c8b9db4be2cd049d7.zip |
Don't allow video edition if not enabled
Diffstat (limited to 'client/src/app')
3 files changed, 10 insertions, 6 deletions
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts index c998b7c49..45a586981 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.ts +++ b/client/src/app/+my-library/my-videos/my-videos.component.ts | |||
@@ -9,7 +9,7 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms' | |||
9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
10 | import { LiveStreamInformationComponent } from '@app/shared/shared-video-live' | 10 | import { LiveStreamInformationComponent } from '@app/shared/shared-video-live' |
11 | import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' | 11 | import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' |
12 | import { VideoChannel, VideoSortField, VideoState } from '@shared/models' | 12 | import { VideoChannel, VideoSortField } from '@shared/models' |
13 | import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component' | 13 | import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component' |
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
@@ -207,7 +207,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
207 | { | 207 | { |
208 | label: $localize`Editor`, | 208 | label: $localize`Editor`, |
209 | linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ], | 209 | linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ], |
210 | isDisplayed: ({ video }) => video.state.id === VideoState.PUBLISHED, | 210 | isDisplayed: ({ video }) => video.isEditableBy(this.authService.getUser(), this.serverService.getHTMLConfig().videoEditor.enabled), |
211 | iconName: 'film' | 211 | iconName: 'film' |
212 | }, | 212 | }, |
213 | { | 213 | { |
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 8e275181c..612fcf16c 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts | |||
@@ -228,6 +228,12 @@ export class Video implements VideoServerModel { | |||
228 | return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) | 228 | return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) |
229 | } | 229 | } |
230 | 230 | ||
231 | isEditableBy (user: AuthUser, videoEditorEnabled: boolean) { | ||
232 | return videoEditorEnabled && | ||
233 | this.state?.id === VideoState.PUBLISHED && | ||
234 | this.isUpdatableBy(user) | ||
235 | } | ||
236 | |||
231 | canRemoveFiles (user: AuthUser) { | 237 | canRemoveFiles (user: AuthUser) { |
232 | return this.isLocal && | 238 | return this.isLocal && |
233 | user.hasRight(UserRight.MANAGE_VIDEO_FILES) && | 239 | user.hasRight(UserRight.MANAGE_VIDEO_FILES) && |
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 abbfc63f8..29a711378 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 | |||
@@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@a | |||
2 | import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core' | 2 | import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core' |
3 | import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' | 3 | import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' |
4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' |
5 | import { VideoCaption, VideoState } from '@shared/models' | 5 | import { VideoCaption } from '@shared/models' |
6 | import { | 6 | import { |
7 | Actor, | 7 | Actor, |
8 | DropdownAction, | 8 | DropdownAction, |
@@ -153,9 +153,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
153 | } | 153 | } |
154 | 154 | ||
155 | isVideoEditable () { | 155 | isVideoEditable () { |
156 | return this.serverService.getHTMLConfig().videoEditor.enabled && | 156 | return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoEditor.enabled) |
157 | this.video.state?.id === VideoState.PUBLISHED && | ||
158 | this.video.isUpdatableBy(this.user) | ||
159 | } | 157 | } |
160 | 158 | ||
161 | isVideoRemovable () { | 159 | isVideoRemovable () { |