mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Don't allow video edition if not enabled
This commit is contained in:
@@ -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'
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user