mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Replace certain uses of 'gsub' with 'tr' or 'chomp' for a speed
improvement
This commit is contained in:
parent
d1c5949922
commit
c0e25b5a9a
9 changed files with 15 additions and 16 deletions
|
@ -94,12 +94,12 @@ module Email
|
|||
|
||||
# http://www.ietf.org/rfc/rfc2919.txt
|
||||
if topic && topic.category && !topic.category.uncategorized?
|
||||
list_id = "<#{topic.category.name.downcase.gsub(' ', '-')}.#{host}>"
|
||||
list_id = "<#{topic.category.name.downcase.tr(' ', '-')}.#{host}>"
|
||||
|
||||
# subcategory case
|
||||
if !topic.category.parent_category_id.nil?
|
||||
parent_category_name = Category.find_by(id: topic.category.parent_category_id).name
|
||||
list_id = "<#{topic.category.name.downcase.gsub(' ', '-')}.#{parent_category_name.downcase.gsub(' ', '-')}.#{host}>"
|
||||
list_id = "<#{topic.category.name.downcase.tr(' ', '-')}.#{parent_category_name.downcase.tr(' ', '-')}.#{host}>"
|
||||
end
|
||||
else
|
||||
list_id = "<#{host}>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue