FEATURE: Flag count in post menu

This change shows a notification number besides the flag icon in the
post menu if there is reviewable content associated with the post.
Additionally, if there is pending stuff to review, the icon has a red
background.

We have also removed the list of links below a post with the flag
status. A reviewer is meant to click the number beside the flag icon to
view the flags. As a consequence of losing those links, we've removed
the ability to undo or ignore flags below a post.
This commit is contained in:
Robin Ward
2019-05-03 14:26:37 -04:00
parent e6843afa9e
commit 31e100530f
24 changed files with 384 additions and 630 deletions

View File

@ -2,73 +2,6 @@ import { moduleForWidget, widgetTest } from "helpers/widget-test";
moduleForWidget("actions-summary");
widgetTest("listing actions", {
template: '{{mount-widget widget="actions-summary" args=args}}',
beforeEach() {
this.set("args", {
actionsSummary: [
{ id: 1, action: "off_topic", description: "very off topic" },
{ id: 2, action: "spam", description: "suspicious message" }
]
});
},
async test(assert) {
assert.equal(find(".post-actions .post-action").length, 2);
await click(".post-action:eq(0) .action-link a");
assert.equal(
find(".post-action:eq(0) img.avatar").length,
1,
"clicking it shows the user"
);
}
});
widgetTest("undo", {
template:
'{{mount-widget widget="actions-summary" args=args undoPostAction=undoPostAction}}',
beforeEach() {
this.set("args", {
actionsSummary: [
{ action: "off_topic", description: "very off topic", canUndo: true }
]
});
this.set("undoPostAction", () => (this.undid = true));
},
async test(assert) {
assert.equal(find(".post-actions .post-action").length, 1);
await click(".action-link.undo");
assert.ok(this.undid, "it triggered the action");
}
});
widgetTest("deferFlags", {
template:
'{{mount-widget widget="actions-summary" args=args deferPostActionFlags=(action "deferPostActionFlags")}}',
beforeEach() {
this.set("args", {
actionsSummary: [
{
action: "off_topic",
description: "very off topic",
canIgnoreFlags: true,
count: 1
}
]
});
this.on("deferPostActionFlags", () => (this.deferred = true));
},
async test(assert) {
assert.equal(find(".post-actions .post-action").length, 1);
await click(".action-link.defer-flags");
assert.ok(this.deferred, "it triggered the action");
}
});
widgetTest("post deleted", {
template: '{{mount-widget widget="actions-summary" args=args}}',
beforeEach() {