From 96a718547d643eacddb09155bad25bfc48457efe Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 27 Feb 2023 09:43:37 +0000 Subject: Try importing journal replies as issue reply where applicable (#38263). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Felix Schäfer. git-svn-id: https://svn.redmine.org/redmine/trunk@22119 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/mail_handler.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 6da848124..2fa4de00d 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -263,15 +263,14 @@ class MailHandler < ActionMailer::Base # Reply will be added to the issue def receive_journal_reply(journal_id) journal = Journal.find_by(:id => journal_id) - if journal.nil? - logger&.info "MailHandler: ignoring reply from [#{email.from.first}] to a nonexistent journal" - return nil - end - if journal.journalized_type == 'Issue' + if journal && journal.journalized_type == 'Issue' receive_issue_reply(journal.journalized_id, journal) + elsif m = email.subject.to_s.match(ISSUE_REPLY_SUBJECT_RE) + logger&.info "MailHandler: reply to a nonexistant journal, calling receive_issue_reply with issue from subject" + receive_issue_reply(m[1].to_i) else - logger&.info "MailHandler: ignoring reply from [#{email.from.first}] to a journal whose journalized_type is not Issue" + logger&.info "MailHandler: ignoring reply to a nonexistant journal or issue" return nil end end -- cgit v1.2.3