Skip to content

Commit

Permalink
FIX: add param to exclude groups on the view more URL (#43)
Browse files Browse the repository at this point in the history
* FIX: add param to exclude groups on the view more URL
  • Loading branch information
jmperez127 authored Aug 11, 2023
1 parent 982bb0d commit aef99be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions javascripts/discourse/components/top-contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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() {
Expand Down
5 changes: 4 additions & 1 deletion test/acceptance/top-contributors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
});
}
);

0 comments on commit aef99be

Please sign in to comment.