FEATURE: add a param to exclude users by groups on the users directory page (#23067)
This commit is contained in:
parent
fb36af7799
commit
918be1dd63
|
@ -9,7 +9,15 @@ import { observes } from "discourse-common/utils/decorators";
|
|||
|
||||
export default Controller.extend({
|
||||
application: controller(),
|
||||
queryParams: ["period", "order", "asc", "name", "group", "exclude_usernames"],
|
||||
queryParams: [
|
||||
"period",
|
||||
"order",
|
||||
"asc",
|
||||
"name",
|
||||
"group",
|
||||
"exclude_usernames",
|
||||
"exclude_groups",
|
||||
],
|
||||
period: "weekly",
|
||||
order: "",
|
||||
asc: null,
|
||||
|
@ -17,6 +25,7 @@ export default Controller.extend({
|
|||
group: null,
|
||||
nameInput: null,
|
||||
exclude_usernames: null,
|
||||
exclude_groups: null,
|
||||
isLoading: false,
|
||||
columns: null,
|
||||
groupOptions: null,
|
||||
|
|
|
@ -12,6 +12,7 @@ export default DiscourseRoute.extend({
|
|||
asc: { refreshModel: true },
|
||||
name: { refreshModel: false, replace: true },
|
||||
group: { refreshModel: true },
|
||||
exclude_groups: { refreshModel: true },
|
||||
exclude_usernames: { refreshModel: true },
|
||||
},
|
||||
|
||||
|
@ -28,6 +29,7 @@ export default DiscourseRoute.extend({
|
|||
name: "",
|
||||
group: null,
|
||||
exclude_usernames: null,
|
||||
exclude_groups: null,
|
||||
lastUpdatedAt: null,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@ import {
|
|||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import directoryFixtures from "discourse/tests/fixtures/directory-fixtures";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
|
||||
acceptance("User Directory", function () {
|
||||
test("Visit Page", async function (assert) {
|
||||
|
@ -37,6 +40,24 @@ acceptance("User Directory", function () {
|
|||
);
|
||||
});
|
||||
|
||||
test("Visit With Group Exclusion", async function (assert) {
|
||||
let queryParams;
|
||||
|
||||
pretender.get("/directory_items", (request) => {
|
||||
queryParams = request.queryParams;
|
||||
|
||||
return response(cloneJSON(directoryFixtures["directory_items"]));
|
||||
});
|
||||
|
||||
await visit("/u?exclude_groups=trust_level_0");
|
||||
|
||||
assert.strictEqual(
|
||||
queryParams.exclude_groups,
|
||||
"trust_level_0",
|
||||
"includes the right query param in the API call"
|
||||
);
|
||||
});
|
||||
|
||||
test("Visit With Group Filter", async function (assert) {
|
||||
await visit("/u?group=trust_level_0");
|
||||
assert.ok(
|
||||
|
|
Loading…
Reference in New Issue