Project

General

Profile

Feature #38263 » 38263.patch

Felix Schäfer, 2023-02-11 22:30

View differences:

app/models/mail_handler.rb
263 263
  # Reply will be added to the issue
264 264
  def receive_journal_reply(journal_id)
265 265
    journal = Journal.find_by(:id => journal_id)
266
    if journal.nil?
267
      logger&.info "MailHandler: ignoring reply from [#{email.from.first}] to a nonexistent journal"
268
      return nil
269
    end
270 266

  
271
    if journal.journalized_type == 'Issue'
267
    if journal && journal.journalized_type == 'Issue'
272 268
      receive_issue_reply(journal.journalized_id, journal)
269
    elsif m = email.subject.to_s.match(ISSUE_REPLY_SUBJECT_RE)
270
      logger&.info "MailHandler: reply to a nonexistant journal, calling receive_issue_reply with issue from subject"
271
      receive_issue_reply(m[1].to_i)
273 272
    else
274
      logger&.info "MailHandler: ignoring reply from [#{email.from.first}] to a journal whose journalized_type is not Issue"
273
      logger&.info "MailHandler: ignoring reply to a nonexistant journal or issue"
275 274
      return nil
276 275
    end
277 276
  end
(1-1/2)