X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-video-miniature%2Fvideo-actions-dropdown.component.ts;h=ed6a4afc0f90c3980c0531f2fe223c91a33e38ef;hb=64324ac646b0938e35cd88771492623b640bd0d8;hp=abbfc63f81f814a6ae92fca6fec2dacd50ef5682;hpb=7b51ede977c299a74728171d8c124bcc4cbba6ea;p=github%2FChocobozzz%2FPeerTube.git 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..ed6a4afc0 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, @@ -29,7 +29,8 @@ export type VideoActionsDisplayType = { liveInfo?: boolean removeFiles?: boolean transcoding?: boolean - editor?: boolean + studio?: boolean + stats?: boolean } @Component({ @@ -61,9 +62,11 @@ export class VideoActionsDropdownComponent implements OnChanges { liveInfo: false, removeFiles: false, transcoding: false, - editor: true + studio: true, + stats: true } @Input() placement = 'left' + @Input() moreActions: DropdownAction<{ video: Video }>[][] = [] @Input() label: string @@ -153,9 +156,11 @@ 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().videoStudio.enabled) + } + + isVideoStatsAvailable () { + return this.video.canSeeStats(this.user) } isVideoRemovable () { @@ -339,10 +344,16 @@ export class VideoActionsDropdownComponent implements OnChanges { isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() }, { - label: $localize`Editor`, - linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ], + label: $localize`Studio`, + linkBuilder: ({ video }) => [ '/studio/edit', video.uuid ], iconName: 'film', - isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.editor && this.isVideoEditable() + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.studio && this.isVideoEditable() + }, + { + label: $localize`Stats`, + linkBuilder: ({ video }) => [ '/stats/videos', video.uuid ], + iconName: 'stats', + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.stats && this.isVideoStatsAvailable() }, { label: $localize`Block`, @@ -410,5 +421,7 @@ export class VideoActionsDropdownComponent implements OnChanges { } ] ] + + this.videoActions = this.videoActions.concat(this.moreActions) } }