Updated code based on review comments
This commit is contained in:
parent
9c761fb9e0
commit
8cd805fccd
|
@ -232,7 +232,7 @@ export class Video implements VideoServerModel {
|
|||
this.isUpdatableBy(user)
|
||||
}
|
||||
|
||||
canSeeStats (user: AuthUser) {
|
||||
isAccessibleBy (user: AuthUser) {
|
||||
return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.SEE_ALL_VIDEOS))
|
||||
}
|
||||
|
||||
|
@ -251,14 +251,6 @@ export class Video implements VideoServerModel {
|
|||
this.hasWebVideos()
|
||||
}
|
||||
|
||||
isDownloadableBy (user: AuthUser) {
|
||||
if (!user || this.isLocal !== true) {
|
||||
return false
|
||||
}
|
||||
|
||||
return this.account.name === user.username || user.hasRight(UserRight.MANAGE_VIDEO_FILES)
|
||||
}
|
||||
|
||||
canRunTranscoding (user: AuthUser) {
|
||||
return this.canRunForcedTranscoding(user) && this.state.id !== VideoState.TO_TRANSCODE
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import {
|
|||
import { LiveStreamInformationComponent } from '../shared-video-live'
|
||||
import { VideoAddToPlaylistComponent } from '../shared-video-playlist'
|
||||
import { VideoDownloadComponent } from './video-download.component'
|
||||
import { of } from 'rxjs'
|
||||
|
||||
export type VideoActionsDisplayType = {
|
||||
playlist?: boolean
|
||||
|
@ -127,13 +128,14 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
|
||||
showDownloadModal () {
|
||||
this.modalOpened.emit()
|
||||
if (!(this.video instanceof VideoDetails)) {
|
||||
this.videoService.getVideo({ videoId: this.video.uuid }).subscribe((details: VideoDetails) => {
|
||||
this.videoDownloadModal.show(details, this.videoCaptions)
|
||||
|
||||
const obs = this.video instanceof VideoDetails
|
||||
? of(this.video)
|
||||
: this.videoService.getVideo({ videoId: this.video.uuid })
|
||||
|
||||
obs.subscribe((videoDetails: VideoDetails) => {
|
||||
this.videoDownloadModal.show(videoDetails, this.videoCaptions)
|
||||
})
|
||||
} else {
|
||||
this.videoDownloadModal.show(this.video, this.videoCaptions)
|
||||
}
|
||||
}
|
||||
|
||||
showReportModal () {
|
||||
|
@ -165,7 +167,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
}
|
||||
|
||||
isVideoStatsAvailable () {
|
||||
return this.video.canSeeStats(this.user)
|
||||
return this.video.isAccessibleBy(this.user)
|
||||
}
|
||||
|
||||
isVideoRemovable () {
|
||||
|
@ -185,11 +187,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
}
|
||||
|
||||
isVideoDownloadable () {
|
||||
if (!this.video || this.video.isLive) {
|
||||
return false
|
||||
}
|
||||
|
||||
return (this.video instanceof VideoDetails && this.video.downloadEnabled) || this.video.isDownloadableBy(this.user)
|
||||
return (this.video &&
|
||||
this.video.isLive !== true &&
|
||||
this.video instanceof VideoDetails &&
|
||||
this.video.downloadEnabled) ||
|
||||
this.video.isAccessibleBy(this.user)
|
||||
}
|
||||
|
||||
canVideoBeDuplicated () {
|
||||
|
|
Loading…
Reference in New Issue
Block a user