2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: You could update a topic to have a title that's too short if the TextCleaner

removed extra characters. Additionally, updating the title will not return an error
message to the client app if the operation fails (rather than failing silently.)
This commit is contained in:
Robin Ward 2013-05-31 15:22:34 -04:00
parent 2982c23265
commit d23ef1d090
6 changed files with 39 additions and 5 deletions

View file

@ -48,7 +48,7 @@ class Topic < ActiveRecord::Base
:case_sensitive => false,
:collection => Proc.new{ Topic.listable_topics } }
after_validation do
before_validation do
self.title = TextCleaner.clean_title(TextSentinel.title_sentinel(title).text) if errors[:title].empty?
end