mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 09:35:46 +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
|
# http://www.ietf.org/rfc/rfc2919.txt
|
||||||
if topic && topic.category && !topic.category.uncategorized?
|
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
|
# subcategory case
|
||||||
if !topic.category.parent_category_id.nil?
|
if !topic.category.parent_category_id.nil?
|
||||||
parent_category_name = Category.find_by(id: topic.category.parent_category_id).name
|
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
|
end
|
||||||
else
|
else
|
||||||
list_id = "<#{host}>"
|
list_id = "<#{host}>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user