discourse/test/javascripts/helpers/flag-pretender.js.es6

74 lines
1.6 KiB
Plaintext
Raw Normal View History

2017-09-11 10:31:38 -04:00
export default function(helpers) {
const { response, success } = helpers;
const eviltrout = {
id: 1,
username: "eviltrout",
2018-06-15 11:03:24 -04:00
avatar_template: "/images/avatar.png"
2017-09-11 10:31:38 -04:00
};
const sam = {
id: 2,
username: "sam",
2018-06-15 11:03:24 -04:00
avatar_template: "/images/avatar.png",
2017-09-11 10:31:38 -04:00
can_delete_all_posts: true,
can_be_deleted: true,
post_count: 1,
topic_count: 0
};
2018-06-15 11:03:24 -04:00
this.get("/admin/flagged_topics", () => {
2017-09-11 10:31:38 -04:00
return response(200, {
2018-06-15 11:03:24 -04:00
flagged_topics: [
2017-09-11 10:31:38 -04:00
{
id: 280,
user_ids: [eviltrout.id, sam.id],
flag_counts: [
{ flag_type_id: 1, count: 3 },
{ flag_type_id: 2, count: 2 },
2018-06-15 11:03:24 -04:00
{ flag_type_id: 3, count: 1 }
2017-09-11 10:31:38 -04:00
]
}
],
2018-06-15 11:03:24 -04:00
users: [eviltrout, sam],
__rest_serializer: "1"
2017-09-11 10:31:38 -04:00
});
});
2018-06-15 11:03:24 -04:00
this.get("/admin/flags/active.json", () => {
2017-09-11 10:31:38 -04:00
return response(200, {
2017-09-11 16:44:20 -04:00
flagged_posts: [
2017-09-11 10:31:38 -04:00
{
id: 1,
user_id: sam.id,
2017-09-11 16:44:20 -04:00
post_action_ids: [1]
2017-09-11 10:31:38 -04:00
}
],
users: [eviltrout, sam],
topics: [],
2018-06-15 11:03:24 -04:00
post_actions: [
{
id: 1,
user_id: eviltrout.id,
post_action_type_id: 8,
name_key: "spam",
conversation: {
response: {
user_id: eviltrout.id,
excerpt: "hello"
},
reply: {
user_id: eviltrout.id,
excerpt: "goodbye"
}
}
}
2018-06-15 11:03:24 -04:00
],
__rest_serializer: "1"
2017-09-11 10:31:38 -04:00
});
});
2018-06-15 11:03:24 -04:00
this.post("/admin/flags/agree/1", success);
this.post("/admin/flags/defer/1", success);
this.post("/admin/flags/disagree/1", success);
2017-09-11 10:31:38 -04:00
}