Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Don't allow video edition if not enabled

Chocobozzz22e909224c02
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 c998b7c490..45a5869819 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'
import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { LiveStreamInformationComponent } from '@app/shared/shared-video-live'
import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
-import { VideoChannel, VideoSortField, VideoState } from '@shared/models'
+import { VideoChannel, VideoSortField } from '@shared/models'
import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component'
@Component({
@@ -207,7 +207,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
{
label: $localize`Editor`,
linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ],
- isDisplayed: ({ video }) => video.state.id === VideoState.PUBLISHED,
+ isDisplayed: ({ video }) => video.isEditableBy(this.authService.getUser(), this.serverService.getHTMLConfig().videoEditor.enabled),
iconName: 'film'
},
{
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 8e275181c4..612fcf16c3 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 {
return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
}
+ isEditableBy (user: AuthUser, videoEditorEnabled: boolean) {
+ return videoEditorEnabled &&
+ this.state?.id === VideoState.PUBLISHED &&
+ this.isUpdatableBy(user)
+ }
+
canRemoveFiles (user: AuthUser) {
return this.isLocal &&
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 abbfc63f81..29a7113785 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
import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation'
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
-import { VideoCaption, VideoState } from '@shared/models'
+import { VideoCaption } from '@shared/models'
import {
Actor,
DropdownAction,
@@ -153,9 +153,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
}
isVideoEditable () {
- return this.serverService.getHTMLConfig().videoEditor.enabled &&
- this.video.state?.id === VideoState.PUBLISHED &&
- this.video.isUpdatableBy(this.user)
+ return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoEditor.enabled)
}
isVideoRemovable () {