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,
liveInfo?: boolean
removeFiles?: boolean
transcoding?: boolean
- editor?: boolean
+ studio?: boolean
+ stats?: boolean
}
@Component({
liveInfo: false,
removeFiles: false,
transcoding: false,
- editor: true
+ studio: true,
+ stats: true
}
@Input() placement = 'left'
+ @Input() moreActions: DropdownAction<{ video: Video }>[][] = []
@Input() label: string
}
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 () {
let message = $localize`Do you really want to delete ${this.video.name}?`
if (this.video.isLive) {
- message += ' ' + $localize`The live stream will be automatically terminated.`
+ message += ' ' + $localize`The live stream will be automatically terminated and replays won't be saved.`
}
const res = await this.confirmService.confirm(message, $localize`Delete ${this.video.name}`)
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`,
}
]
]
+
+ this.videoActions = this.videoActions.concat(this.moreActions)
}
}