Project

General

Profile

Feature #17699 » 17699-fix-using-mail-address-object-v3.diff

Go MAEDA, 2019-02-16 08:00

View differences:

app/models/mail_handler.rb (作業コピー)
536 536
  # Creates a User for the +email+ sender
537 537
  # Returns the user or nil if it could not be created
538 538
  def create_user_from_email
539
    from = email.header['from'].to_s
540
    addr, name = from, nil
541
    if m = from.match(/^"?(.+?)"?\s+<(.+@.+)>$/)
542
      addr, name = m[2], m[1]
543
    end
544
    if addr.present?
539
    if from_addr = email.header['from'].try(:addrs).try(:first)
540
      addr = from_addr.address
541
      name = from_addr.display_name || from_addr.comments.try(:first)
545 542
      user = self.class.new_user_from_attributes(addr, name)
546 543
      if handler_options[:no_notification]
547 544
        user.mail_notification = 'none'
(5-5/6)