2016-12-11 10:36:15 -05:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
|
2018-03-27 00:18:03 -04:00
|
|
|
acceptance("Group logs", {
|
2016-12-11 10:36:15 -05:00
|
|
|
loggedIn: true,
|
2018-07-26 06:16:32 -04:00
|
|
|
pretend(server, helper) {
|
|
|
|
server.get("/groups/snorlax.json", () => {
|
|
|
|
return helper.response({
|
2018-03-29 02:57:10 -04:00
|
|
|
group: {
|
|
|
|
id: 41,
|
|
|
|
automatic: false,
|
|
|
|
name: "snorlax",
|
|
|
|
user_count: 1,
|
|
|
|
alias_level: 0,
|
|
|
|
visible: true,
|
|
|
|
automatic_membership_email_domains: "",
|
|
|
|
primary_group: true,
|
|
|
|
title: "Team Snorlax",
|
|
|
|
grant_trust_level: null,
|
|
|
|
incoming_email: null,
|
|
|
|
has_messages: false,
|
|
|
|
flair_url: "",
|
|
|
|
flair_bg_color: "",
|
|
|
|
flair_color: "",
|
|
|
|
bio_raw: "",
|
|
|
|
bio_cooked: null,
|
|
|
|
public: true,
|
|
|
|
is_group_user: true,
|
|
|
|
is_group_owner: true,
|
2018-06-15 11:03:24 -04:00
|
|
|
},
|
2018-03-29 02:57:10 -04:00
|
|
|
});
|
2016-12-11 10:36:15 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// Workaround while awaiting https://github.com/tildeio/route-recognizer/issues/53
|
2018-07-26 06:16:32 -04:00
|
|
|
server.get("/groups/snorlax/logs.json", (request) => {
|
2016-12-11 10:36:15 -05:00
|
|
|
if (request.queryParams["filters[action]"]) {
|
2018-07-26 06:16:32 -04:00
|
|
|
return helper.response({
|
2017-02-17 16:17:59 -05:00
|
|
|
logs: [
|
2018-06-15 11:03:24 -04:00
|
|
|
{
|
2017-02-17 16:17:59 -05:00
|
|
|
action: "change_group_setting",
|
|
|
|
subject: "title",
|
|
|
|
prev_value: null,
|
|
|
|
new_value: "Team Snorlax",
|
|
|
|
created_at: "2016-12-12T08:27:46.408Z",
|
|
|
|
acting_user: {
|
|
|
|
id: 1,
|
|
|
|
username: "tgx",
|
|
|
|
avatar_template: "/images/avatar.png",
|
|
|
|
},
|
|
|
|
target_user: null,
|
2018-06-15 11:03:24 -04:00
|
|
|
},
|
2017-02-17 16:17:59 -05:00
|
|
|
],
|
|
|
|
all_loaded: true,
|
|
|
|
});
|
2016-12-11 10:36:15 -05:00
|
|
|
} else {
|
2018-07-26 06:16:32 -04:00
|
|
|
return helper.response({
|
2017-02-17 16:17:59 -05:00
|
|
|
logs: [
|
2018-06-15 11:03:24 -04:00
|
|
|
{
|
2017-02-17 16:17:59 -05:00
|
|
|
action: "change_group_setting",
|
|
|
|
subject: "title",
|
|
|
|
prev_value: null,
|
|
|
|
new_value: "Team Snorlax",
|
|
|
|
created_at: "2016-12-12T08:27:46.408Z",
|
|
|
|
acting_user: {
|
|
|
|
id: 1,
|
|
|
|
username: "tgx",
|
|
|
|
avatar_template: "/images/avatar.png",
|
|
|
|
},
|
|
|
|
target_user: null,
|
|
|
|
},
|
2018-06-15 11:03:24 -04:00
|
|
|
{
|
2017-02-17 16:17:59 -05:00
|
|
|
action: "add_user_to_group",
|
|
|
|
subject: null,
|
|
|
|
prev_value: null,
|
|
|
|
new_value: null,
|
|
|
|
created_at: "2016-12-12T08:27:27.725Z",
|
|
|
|
acting_user: {
|
|
|
|
id: 1,
|
|
|
|
username: "tgx",
|
|
|
|
avatar_template: "/images/avatar.png",
|
|
|
|
},
|
|
|
|
target_user: {
|
|
|
|
id: 1,
|
|
|
|
username: "tgx",
|
|
|
|
avatar_template: "/images/avatar.png",
|
2018-06-15 11:03:24 -04:00
|
|
|
},
|
|
|
|
},
|
2017-02-17 16:17:59 -05:00
|
|
|
],
|
|
|
|
all_loaded: true,
|
|
|
|
});
|
2016-12-11 10:36:15 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-07-26 06:16:32 -04:00
|
|
|
QUnit.test("Browsing group logs", async (assert) => {
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/snorlax/manage/logs");
|
2018-07-26 06:16:32 -04:00
|
|
|
assert.ok(
|
|
|
|
find("tr.group-manage-logs-row").length === 2,
|
|
|
|
"it should display the right number of logs"
|
|
|
|
);
|
2016-12-11 10:36:15 -05:00
|
|
|
|
2018-07-26 06:16:32 -04:00
|
|
|
await click(find(".group-manage-logs-row button")[0]);
|
|
|
|
assert.ok(
|
|
|
|
find("tr.group-manage-logs-row").length === 1,
|
|
|
|
"it should display the right number of logs"
|
|
|
|
);
|
2018-03-27 00:18:03 -04:00
|
|
|
});
|