FIX: Groups list does not refresh when query changes. (#6481)

This commit is contained in:
Bianca Nenciu 2018-10-11 16:20:17 +03:00 committed by Régis Hanol
parent 1b0fbc4d30
commit ded5ff90aa
4 changed files with 37 additions and 2 deletions

View File

@ -11,8 +11,6 @@ export default Discourse.Route.extend({
username: { refreshModel: true }
},
refreshQueryWithoutTransition: true,
model(params) {
this._params = params;
return this.store.findAll("group", params);

View File

@ -3,6 +3,10 @@ import { acceptance } from "helpers/qunit-helpers";
acceptance("Groups");
QUnit.test("Browsing Groups", async assert => {
await visit("/groups?username=eviltrout");
assert.equal(count(".groups-table-row"), 1, "it displays user's groups");
await visit("/groups");
assert.equal(count(".groups-table-row"), 2, "it displays visible groups");

View File

@ -50,5 +50,34 @@ export default {
extras: { group_user_ids: [] },
total_rows_groups: 2,
load_more_groups: "/groups?page=1"
},
"/groups.json?username=eviltrout": {
groups: [
{
id: 41,
automatic: false,
name: "discourse",
user_count: 0,
alias_level: 0,
visible: true,
automatic_membership_email_domains: "",
automatic_membership_retroactive: false,
primary_group: false,
title: null,
grant_trust_level: null,
has_messages: false,
flair_url: null,
flair_bg_color: null,
flair_color: null,
bio_raw: "",
bio_cooked: null,
public_admission: true,
allow_membership_requests: false,
full_name: "Awesome Team"
}
],
extras: { group_user_ids: [] },
total_rows_groups: 1,
load_more_groups: "/groups?page=1"
}
};

View File

@ -350,6 +350,10 @@ export default function() {
return response(200, fixturesByUrl["/groups.json"]);
});
this.get("/groups.json", () => {
return response(200, fixturesByUrl["/groups.json?username=eviltrout"]);
});
this.get("groups/search.json", () => {
return response(200, []);
});