-import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
+import { AfterViewInit, Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { DropdownAction, DropdownButtonSize, DropdownDirection } from '@app/shared/buttons/action-dropdown.component'
import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
delete: true,
report: true
}
- @Input() placement: string = 'left'
+ @Input() placement = 'left'
@Input() label: string
}
ngOnChanges () {
+ if (this.loaded) {
+ this.loaded = false
+ this.playlistAdd.unload()
+ }
+
this.buildActions()
}
return this.video.isUnblacklistableBy(this.user)
}
+ isVideoDownloadable () {
+ return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled
+ }
+
/* Action handlers */
async unblacklistVideo () {
{
label: this.i18n('Download'),
handler: () => this.showDownloadModal(),
- isDisplayed: () => this.displayOptions.download,
+ isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(),
iconName: 'download'
},
{