mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:33:24 +08:00
Fix: Editing a topic with an invalid title will still push it to the top (#4185)
* fix: Editing a topic with an invalid title will still push it to the top * add specs to check topic not bumped with invalid title
This commit is contained in:
parent
38d0697b2f
commit
d1f61015c0
|
@ -363,7 +363,7 @@ class PostRevisor
|
|||
end
|
||||
|
||||
def bypass_bump?
|
||||
!@post_successfully_saved || @opts[:bypass_bump] == true
|
||||
!@post_successfully_saved || @topic_changes.errored? || @opts[:bypass_bump] == true
|
||||
end
|
||||
|
||||
def is_last_post?
|
||||
|
|
|
@ -488,6 +488,13 @@ describe Topic do
|
|||
@topic.reload
|
||||
}.not_to change(@topic, :bumped_at)
|
||||
end
|
||||
|
||||
it "doesn't bump the topic when a post have invalid topic title while edit" do
|
||||
expect {
|
||||
@last_post.revise(Fabricate(:moderator), { title: 'invalid title' })
|
||||
@topic.reload
|
||||
}.not_to change(@topic, :bumped_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user