From f238aec54f93bf6ef73ef17be23159ecd1d83f96 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Jun 2019 11:08:56 +0200 Subject: [PATCH] Fix video action dropdown --- .../buttons/action-dropdown.component.ts | 6 ---- .../video/video-actions-dropdown.component.ts | 32 ++++++++----------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts index f5345831b..c9dbbfda2 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.ts +++ b/client/src/app/shared/buttons/action-dropdown.component.ts @@ -41,10 +41,4 @@ export class ActionDropdownComponent { areActionsDisplayed (actions: DropdownAction[], entry: T) { return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry)) } - - handleClick (event: Event, action: DropdownAction) { - event.preventDefault() - - // action.handler(entry) - } } diff --git a/client/src/app/shared/video/video-actions-dropdown.component.ts b/client/src/app/shared/video/video-actions-dropdown.component.ts index 0bbc783c1..8d4e33697 100644 --- a/client/src/app/shared/video/video-actions-dropdown.component.ts +++ b/client/src/app/shared/video/video-actions-dropdown.component.ts @@ -188,19 +188,16 @@ export class VideoActionsDropdownComponent implements OnChanges { } private buildActions () { - this.videoActions = [] - - if (this.authService.isLoggedIn()) { - this.videoActions.push([ + this.videoActions = [ + [ { label: this.i18n('Save to playlist'), handler: () => this.playlistDropdown.toggle(), - isDisplayed: () => this.displayOptions.playlist, + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist, iconName: 'playlist-add' } - ]) - - this.videoActions.push([ + ], + [ { label: this.i18n('Download'), handler: () => this.showDownloadModal(), @@ -211,36 +208,35 @@ export class VideoActionsDropdownComponent implements OnChanges { label: this.i18n('Update'), linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], iconName: 'edit', - isDisplayed: () => this.displayOptions.update && this.isVideoUpdatable() + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() }, { label: this.i18n('Blacklist'), handler: () => this.showBlacklistModal(), iconName: 'no', - isDisplayed: () => this.displayOptions.blacklist && this.isVideoBlacklistable() + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlacklistable() }, { label: this.i18n('Unblacklist'), handler: () => this.unblacklistVideo(), iconName: 'undo', - isDisplayed: () => this.displayOptions.blacklist && this.isVideoUnblacklistable() + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblacklistable() }, { label: this.i18n('Delete'), handler: () => this.removeVideo(), - isDisplayed: () => this.displayOptions.delete && this.isVideoRemovable(), + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(), iconName: 'delete' } - ]) - - this.videoActions.push([ + ], + [ { label: this.i18n('Report'), handler: () => this.showReportModal(), - isDisplayed: () => this.displayOptions.report, + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report, iconName: 'alert' } - ]) - } + ] + ] } } -- 2.41.0