Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix action dropdown with query params

Chocobozzzd50e8d1aee3d
diff --git a/client/src/app/shared/shared-main/buttons/action-dropdown.component.html b/client/src/app/shared/shared-main/buttons/action-dropdown.component.html
index cdcfb9a48e..474baafd75 100644
--- a/client/src/app/shared/shared-main/buttons/action-dropdown.component.html
+++ b/client/src/app/shared/shared-main/buttons/action-dropdown.component.html
@@ -26,7 +26,7 @@
<a
*ngIf="action.linkBuilder && !action.isHeader" [ngClass]="{ 'with-icon': !!action.iconName }"
- class="dropdown-item" [routerLink]="action.linkBuilder(entry)" [queryParams]="action.queryParamsBuilder(entry)" [title]="action.title || ''"
+ class="dropdown-item" [routerLink]="action.linkBuilder(entry)" [queryParams]="getQueryParams(action, entry)" [title]="action.title || ''"
>
<ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
</a>
diff --git a/client/src/app/shared/shared-main/buttons/action-dropdown.component.ts b/client/src/app/shared/shared-main/buttons/action-dropdown.component.ts
index ad55677d86..e6164fced0 100644
--- a/client/src/app/shared/shared-main/buttons/action-dropdown.component.ts
+++ b/client/src/app/shared/shared-main/buttons/action-dropdown.component.ts
@@ -48,6 +48,12 @@ export class ActionDropdownComponent<T> {
return [ this.actions as DropdownAction<T>[] ]
}
+ getQueryParams (action: DropdownAction<T>, entry: T) {
+ if (action.queryParamsBuilder) return action.queryParamsBuilder(entry)
+
+ return {}
+ }
+
areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
return actions.some(a => {
if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)