mirror of
https://github.com/diaspora/diaspora.git
synced 2026-01-09 15:18:11 -05:00
Merge pull request #8421 from SuperTux88/cleanup-from-header-unicode-emojis
Cleanup unicode emojis from email headers
This commit is contained in:
@@ -36,15 +36,23 @@ module NotificationMailers
|
||||
|
||||
def default_headers
|
||||
from_name = AppConfig.settings.pod_name
|
||||
from_name += " (#{@sender.profile.full_name.empty? ? @sender.username : @sender.name})" if @sender.present?
|
||||
from_name += " (#{person_name(@sender)})" if @sender.present?
|
||||
|
||||
{
|
||||
from: name_and_address(from_name, AppConfig.mail.sender_address),
|
||||
to: name_and_address(@recipient.name, @recipient.email),
|
||||
to: name_and_address(person_name(@recipient), @recipient.email),
|
||||
template_name: self.class.name.demodulize.underscore
|
||||
}
|
||||
end
|
||||
|
||||
def person_name(person)
|
||||
if person.profile.full_name.empty?
|
||||
person.username
|
||||
else
|
||||
person.name.gsub(/\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Presentation}/, "").strip
|
||||
end
|
||||
end
|
||||
|
||||
def with_recipient_locale(&block)
|
||||
I18n.with_locale(@recipient.language, &block)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user