Add ability to download videos from my videos page
This commit is contained in:
parent
ea01bf0167
commit
9c761fb9e0
|
@ -48,7 +48,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
|
|||
}
|
||||
videoDropdownDisplayOptions: VideoActionsDisplayType = {
|
||||
playlist: false,
|
||||
download: false,
|
||||
download: true,
|
||||
update: false,
|
||||
blacklist: false,
|
||||
delete: true,
|
||||
|
|
|
@ -251,6 +251,14 @@ 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
|
||||
}
|
||||
|
|
|
@ -127,8 +127,13 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
|
||||
showDownloadModal () {
|
||||
this.modalOpened.emit()
|
||||
|
||||
this.videoDownloadModal.show(this.video as VideoDetails, this.videoCaptions)
|
||||
if (!(this.video instanceof VideoDetails)) {
|
||||
this.videoService.getVideo({ videoId: this.video.uuid }).subscribe((details: VideoDetails) => {
|
||||
this.videoDownloadModal.show(details, this.videoCaptions)
|
||||
})
|
||||
} else {
|
||||
this.videoDownloadModal.show(this.video, this.videoCaptions)
|
||||
}
|
||||
}
|
||||
|
||||
showReportModal () {
|
||||
|
@ -180,10 +185,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
}
|
||||
|
||||
isVideoDownloadable () {
|
||||
return this.video &&
|
||||
this.video.isLive !== true &&
|
||||
this.video instanceof VideoDetails &&
|
||||
this.video.downloadEnabled
|
||||
if (!this.video || this.video.isLive) {
|
||||
return false
|
||||
}
|
||||
|
||||
return (this.video instanceof VideoDetails && this.video.downloadEnabled) || this.video.isDownloadableBy(this.user)
|
||||
}
|
||||
|
||||
canVideoBeDuplicated () {
|
||||
|
|
Loading…
Reference in New Issue
Block a user