From 13c143246045b3e068d2754e45bcf609ced07b00 Mon Sep 17 00:00:00 2001 From: Jean Perez Date: Thu, 10 Aug 2023 18:49:40 -0300 Subject: [PATCH 1/3] FIX: add param to exclude groups on the view more URL --- javascripts/discourse/components/top-contributors.js | 6 +++--- 1 file changed, 3 insertions(+), 3 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() { From 59b689bce65c61939b758c7391dc0e5f34190925 Mon Sep 17 00:00:00 2001 From: Jean Perez Date: Thu, 10 Aug 2023 23:09:11 -0300 Subject: [PATCH 2/3] fix tests --- test/acceptance/top-contributors-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acceptance/top-contributors-test.js b/test/acceptance/top-contributors-test.js index 6333796..4678869 100644 --- a/test/acceptance/top-contributors-test.js +++ b/test/acceptance/top-contributors-test.js @@ -166,7 +166,7 @@ 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"); }); } ); From 6d038f615cddcad9adba566eb52dc1d0317ae364 Mon Sep 17 00:00:00 2001 From: Jean Perez Date: Thu, 10 Aug 2023 23:10:35 -0300 Subject: [PATCH 3/3] fix linting --- test/acceptance/top-contributors-test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/acceptance/top-contributors-test.js b/test/acceptance/top-contributors-test.js index 4678869..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&exclude_groups=Team|contributors"); + .hasAttribute( + "href", + "/u?order=likes_given&period=weekly&exclude_groups=Team|contributors" + ); }); } );