FIX: disable flagging hidden posts

This commit is contained in:
Penar Musaraj 2018-11-02 13:54:45 -04:00
parent 5cd055fd30
commit 94f628fb4c
2 changed files with 11 additions and 1 deletions

View File

@ -109,7 +109,7 @@ registerButton("like-count", attrs => {
}); });
registerButton("flag", attrs => { registerButton("flag", attrs => {
if (attrs.canFlag) { if (attrs.canFlag && !attrs.hidden) {
return { return {
action: "showFlags", action: "showFlags",
title: "post.controls.flag", title: "post.controls.flag",

View File

@ -389,6 +389,16 @@ widgetTest(`flagging: can't flag`, {
} }
}); });
widgetTest(`flagging: can't flag when post is hidden`, {
template: '{{mount-widget widget="post" args=args}}',
beforeEach() {
this.set("args", { canFlag: true, hidden: true });
},
test(assert) {
assert.ok(this.$("button.create-flag").length === 0);
}
});
widgetTest(`read indicator`, { widgetTest(`read indicator`, {
template: '{{mount-widget widget="post" args=args}}', template: '{{mount-widget widget="post" args=args}}',
beforeEach() { beforeEach() {