Skip to content

Commit aef99be

Browse files
authored
FIX: add param to exclude groups on the view more URL (#43)
* FIX: add param to exclude groups on the view more URL
1 parent 982bb0d commit aef99be

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

javascripts/discourse/components/top-contributors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default class TopContributors extends Component {
77
order = this.args.params?.order || "likes_received";
88
period = this.args.params?.period || "yearly";
99
count = this.args.params?.count || 5;
10+
excludedGroupNames = this.args.params?.excludedGroupNames || "";
1011

1112
constructor() {
1213
super(...arguments);
@@ -17,12 +18,11 @@ export default class TopContributors extends Component {
1718
}
1819

1920
get requestURL() {
20-
const excludedGroupNames = this.args.params?.excludedGroupNames || "";
21-
return `/directory_items.json?period=${this.period}&order=${this.order}&exclude_groups=${excludedGroupNames}&limit=${this.count}`;
21+
return `/directory_items.json?period=${this.period}&order=${this.order}&exclude_groups=${this.excludedGroupNames}&limit=${this.count}`;
2222
}
2323

2424
get viewAllUrl() {
25-
return `/u?order=${this.order}&period=${this.period}`;
25+
return `/u?order=${this.order}&period=${this.period}&exclude_groups=${this.excludedGroupNames}`;
2626
}
2727

2828
willDestroy() {

test/acceptance/top-contributors-test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ acceptance(
166166

167167
assert
168168
.dom(".top-contributors--view-all")
169-
.hasAttribute("href", "/u?order=likes_given&period=weekly");
169+
.hasAttribute(
170+
"href",
171+
"/u?order=likes_given&period=weekly&exclude_groups=Team|contributors"
172+
);
170173
});
171174
}
172175
);

0 commit comments

Comments
 (0)