From aef99be050606eda8bf5ee91aafe7c9573b45b9a Mon Sep 17 00:00:00 2001 From: Jean Date: Fri, 11 Aug 2023 00:27:36 -0400 Subject: [PATCH] FIX: add param to exclude groups on the view more URL (#43) * FIX: add param to exclude groups on the view more URL --- javascripts/discourse/components/top-contributors.js | 6 +++--- test/acceptance/top-contributors-test.js | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/javascripts/discourse/components/top-contributors.js b/javascripts/discourse/components/top-contributors.js index 443927c..5c6f8b8 100644 --- a/javascripts/discourse/components/top-contributors.js +++ b/javascripts/discourse/components/top-contributors.js @@ -7,6 +7,7 @@ export default class TopContributors extends Component { order = this.args.params?.order || "likes_received"; period = this.args.params?.period || "yearly"; count = this.args.params?.count || 5; + excludedGroupNames = this.args.params?.excludedGroupNames || ""; constructor() { super(...arguments); @@ -17,12 +18,11 @@ export default class TopContributors extends Component { } get requestURL() { - const excludedGroupNames = this.args.params?.excludedGroupNames || ""; - return `/directory_items.json?period=${this.period}&order=${this.order}&exclude_groups=${excludedGroupNames}&limit=${this.count}`; + return `/directory_items.json?period=${this.period}&order=${this.order}&exclude_groups=${this.excludedGroupNames}&limit=${this.count}`; } get viewAllUrl() { - return `/u?order=${this.order}&period=${this.period}`; + return `/u?order=${this.order}&period=${this.period}&exclude_groups=${this.excludedGroupNames}`; } willDestroy() { diff --git a/test/acceptance/top-contributors-test.js b/test/acceptance/top-contributors-test.js index 6333796..f04c651 100644 --- a/test/acceptance/top-contributors-test.js +++ b/test/acceptance/top-contributors-test.js @@ -166,7 +166,10 @@ acceptance( assert .dom(".top-contributors--view-all") - .hasAttribute("href", "/u?order=likes_given&period=weekly"); + .hasAttribute( + "href", + "/u?order=likes_given&period=weekly&exclude_groups=Team|contributors" + ); }); } );