FIX: Hiding a post should not trigger the duplicate check (#11680)

If for some reason a post was allowed to be duplicated (probably via
staff edit) hiding it should be permitted.
This commit is contained in:
Robin Ward
2021-01-11 14:56:08 -05:00
committed by GitHub
parent 2f84ab6e0a
commit 49b753eee0
2 changed files with 16 additions and 0 deletions

View File

@@ -1301,6 +1301,21 @@ describe Post do
end
end
describe ".hide!" do
after do
Discourse.redis.flushdb
end
it "should ignore the duplicate check" do
p1 = Fabricate(:post)
p2 = Fabricate(:post, user: p1.user)
SiteSetting.unique_posts_mins = 10
p1.store_unique_post_key
p2.reload.hide!(PostActionType.types[:off_topic])
expect(p2).to be_hidden
end
end
describe ".unhide!" do
before { SiteSetting.unique_posts_mins = 5 }