FIX: Array#first with block will return the first element if nothing matches.

This commit is contained in:
Guo Xiang Tan
2016-02-24 22:34:40 +08:00
parent f259d7a7b9
commit e7cfbfeabb
2 changed files with 16 additions and 10 deletions
+2 -2
View File
@@ -261,8 +261,8 @@ class PostAlerter
topic_title = post.topic.title
# when sending a private message email, keep the original title
if post.topic.private_message? && modifications = post.revisions.map(&:modifications).to_a
if first_title_modification = modifications.first { |m| m.has_key?("title") }
if post.topic.private_message? && modifications = post.revisions.map(&:modifications)
if first_title_modification = modifications.find { |m| m.has_key?("title") }
topic_title = first_title_modification["title"][0]
end
end