mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
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:
parent
2f84ab6e0a
commit
49b753eee0
|
@ -529,6 +529,7 @@ class Post < ActiveRecord::Base
|
|||
self.hidden = true
|
||||
self.hidden_at = Time.zone.now
|
||||
self.hidden_reason_id = reason
|
||||
self.skip_unique_check = true
|
||||
save!
|
||||
|
||||
Topic.where(
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user