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:
shaktikatare1989 2016-04-25 14:03:38 +05:30 committed by Régis Hanol
parent 38d0697b2f
commit d1f61015c0
2 changed files with 8 additions and 1 deletions

View File

@ -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?

View File

@ -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