mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 11:58:10 +08:00
optimize string replacment
This commit is contained in:
parent
976692b387
commit
1821ba8d93
@ -87,12 +87,12 @@ module Email
|
||||
|
||||
# http://www.ietf.org/rfc/rfc2919.txt
|
||||
if topic && topic.category && !topic.category.uncategorized?
|
||||
list_id = "<#{topic.category.name.downcase.split(' ').join('-')}.#{host}>"
|
||||
list_id = "<#{topic.category.name.downcase.gsub(' ', '-')}.#{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.split(' ').join('-')}.#{parent_category_name.downcase.split(' ').join('-')}.#{host}>"
|
||||
list_id = "<#{topic.category.name.downcase.gsub(' ', '-')}.#{parent_category_name.downcase.gsub(' ', '-')}.#{host}>"
|
||||
end
|
||||
else
|
||||
list_id = "<#{host}>"
|
||||
|
Loading…
x
Reference in New Issue
Block a user