]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/buttons/action-dropdown.component.ts
Show default avatar on network error for comments
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / buttons / action-dropdown.component.ts
index c9dbbfda243035c10b905903ae5ba594e6f0de9e..5330ca220958e365e7541ffbba0bad207c09ca09 100644 (file)
@@ -23,7 +23,7 @@ export class ActionDropdownComponent<T> {
   @Input() actions: DropdownAction<T>[] | DropdownAction<T>[][] = []
   @Input() entry: T
 
-  @Input() placement = 'bottom-left'
+  @Input() placement = 'bottom-left auto'
 
   @Input() buttonSize: DropdownButtonSize = 'normal'
   @Input() buttonDirection: DropdownDirection = 'horizontal'
@@ -38,7 +38,11 @@ export class ActionDropdownComponent<T> {
     return [ this.actions ]
   }
 
-  areActionsDisplayed (actions: DropdownAction<T>[], entry: T) {
-    return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry))
+  areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
+    return actions.some(a => {
+      if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)
+
+      return a.isDisplayed === undefined || a.isDisplayed(entry)
+    })
   }
 }