UX: Rename "Keep Post" to "Keep Post Hidden" when hidden (#7767)

* UX: Rename "Keep Post" to "Keep Post Hidden" when hidden

This is based on this feedback:
https://meta.discourse.org/t/category-group-review-moderation/116478/19

When a post is hidden this makes the operation much more clear.

* REFACTOR: Better support for aliases for actions

Allow calls on alias actions and delegate to the original one.
This is less code but also simplifies tests where the action might
be "agree_and_keep" or "agree_and_keep_hidden" which are the same.
This commit is contained in:
Robin Ward
2019-08-01 11:23:23 -04:00
committed by GitHub
parent 23dd50316c
commit 6f367dde26
4 changed files with 36 additions and 16 deletions

View File

@@ -31,6 +31,7 @@ RSpec.describe ReviewableFlaggedPost, type: :model do
actions = reviewable.actions_for(guardian)
expect(actions.has?(:agree_and_hide)).to eq(true)
expect(actions.has?(:agree_and_keep)).to eq(true)
expect(actions.has?(:agree_and_keep_hidden)).to eq(false)
expect(actions.has?(:agree_and_silence)).to eq(true)
expect(actions.has?(:agree_and_suspend)).to eq(true)
expect(actions.has?(:delete_spammer)).to eq(true)
@@ -54,6 +55,13 @@ RSpec.describe ReviewableFlaggedPost, type: :model do
expect(actions.has?(:delete_and_replies)).to eq(false)
end
it "changes `agree_and_keep` to `agree_and_keep_hidden` if it's been hidden" do
post.hidden = true
actions = reviewable.actions_for(guardian)
expect(actions.has?(:agree_and_keep)).to eq(false)
expect(actions.has?(:agree_and_keep_hidden)).to eq(true)
end
it "returns `agree_and_restore` if the post is user deleted" do
post.update(user_deleted: true)
expect(reviewable.actions_for(guardian).has?(:agree_and_restore)).to eq(true)