OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
error reply for failed incoming email (#10726)
Markus Kahld5f00b5700ea
diff --git a/.rubocop.yml b/.rubocop.ymlindex 082aba4b69c..639762b1c6f 100644--- a/.rubocop.yml+++ b/.rubocop.yml@@ -175,7 +175,7 @@ RSpec/MultipleMemoizedHelpers:Enabled: falseRSpec/NestedGroups:- Max: 4+ Enabled: false# Don't force the second argument of describe# to be .class_method or #instance_methoddiff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rbindex 7a8b4cfb802..ecdeec2458b 100644--- a/app/mailers/user_mailer.rb+++ b/app/mailers/user_mailer.rb@@ -224,8 +224,40 @@ class UserMailer < ApplicationMailersend_mail(admin, t("mail_user_activation_limit_reached.subject"))end+ ##+ # E-Mail sent to a user when they tried sending an email to OpenProject to create or update+ # a work package, or forum message for instance.+ #+ # @param [User] user User who sent the email+ # @param [Mail] mail Sent email+ # @param [Array<String>] List of logs collected during processing of the email+ def incoming_email_error(user, mail, logs)+ @user = user+ @mail = mail+ @logs = logs+ @received_at = DateTime.now+ @incoming_text = incoming_email_text mail+ @quote = incoming_email_quote mail++ headers['References'] = ["<#{mail.message_id}>"]+ headers['In-Reply-To'] = ["<#{mail.message_id}>"]++ send_mail user, mail.subject.present? ? "Re: #{mail.subject}" : I18n.t("mail_subject_incoming_email_error")+ end+private+ def incoming_email_text(mail)+ mail.text_part.present? ? mail.text_part.body.to_s : mail.body.to_s+ end++ def incoming_email_quote(mail)+ quote = incoming_email_text(mail)+ quoted = String(quote).lines.join("> ")++ "> #{quoted}"+ end+def open_project_wiki_headers(wiki_content)open_project_headers 'Project' => wiki_content.project.identifier,'Wiki-Page-Id' => wiki_content.page.id,diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rbindex 9c8daae701d..9df8836c2b7 100644--- a/app/models/mail_handler.rb+++ b/app/models/mail_handler.rb@@ -34,7 +34,14 @@ class MailHandler < ActionMailer::Baseclass MissingInformation < StandardError; end- attr_reader :email, :sender_email, :user, :options+ attr_reader :email, :sender_email, :user, :options, :logs++ def initialize+ super++ @result = false+ @logs = []+ end### Code copied from base class and extended with optional options parameter@@ -70,7 +77,8 @@ class MailHandler < ActionMailer::Base@sender_email = email.from.to_a.first.to_s.strip# Ignore emails received from the application emission address to avoid hell cyclesif sender_email.downcase == Setting.mail_from.to_s.strip.downcase- log "ignoring email from emission address [#{sender_email}]"+ log "ignoring email from emission address [#{sender_email}]", report: false+ # don't report back errors to ourselvesreturn falseend# Ignore auto generated emails@@ -79,7 +87,8 @@ class MailHandler < ActionMailer::Baseif valuevalue = value.to_s.downcaseif (ignored_value.is_a?(Regexp) && value.match(ignored_value)) || value == ignored_value- log "ignoring email with #{key}:#{value} header"+ log "ignoring email with #{key}:#{value} header", report: false+ # no point reporting back in case of auto-generated emailsreturn falseendend@@ -106,12 +115,14 @@ class MailHandler < ActionMailer::Baseendelse# Default behaviour, emails from unknown users are ignored- log "ignoring email from unknown user [#{sender_email}]"+ log "ignoring email from unknown user [#{sender_email}]", report: falsereturn falseendendUser.current = @userdispatch+ ensure+ report_errors if !@result && Setting.report_incoming_email_errors?enddef options=(value)@@ -151,14 +162,11 @@ class MailHandler < ActionMailer::Base# Relying on the subject of the mail, which had been implemented before, is brittle as it relies on the user not altering# the subject. Additionally, the subject structure might change, e.g. via localization changes.def dispatch- if (m, object_id = dispatch_target_from_header)- m.call(object_id)- else- dispatch_to_default- end+ m, object_id = dispatch_target_from_header++ @result = m ? m.call(object_id) : dispatch_to_defaultrescue ActiveRecord::RecordInvalid => e- # TODO: send a email to the user- logger&.error e.message+ log "could not save record: #{e.message}", :errorfalserescue MissingInformation => elog "missing information from #{user}: #{e.message}", :error@@ -597,11 +605,19 @@ class MailHandler < ActionMailer::Baseget_keyword(:done_ratio, override: true, format: '(\d|10)?0')end- def log(message, level = :info)+ def log(message, level = :info, report: true)+ logs << "#{level}: #{message}" if report+message = "MailHandler: #{message}"logger.public_send(level, message)end+ def report_errors+ return if logs.empty?++ UserMailer.incoming_email_error(user, email, logs).deliver_later+ end+def work_package_create_contract_classif options[:no_permission_check]CreateWorkPackageWithoutAuthorizationsContractdiff --git a/app/views/user_mailer/incoming_email_error.html.erb b/app/views/user_mailer/incoming_email_error.html.erbnew file mode 100644index 00000000000..abec4dae15d--- /dev/null+++ b/app/views/user_mailer/incoming_email_error.html.erb@@ -0,0 +1,50 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2022 the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See COPYRIGHT and LICENSE files for more details.++++#%>++<h2><%= t(:mail_body_incoming_email_error) %></h2>++<p>+ <%= t(:mail_body_incoming_email_error_logs) %>:+</p>++<code>+<%= @logs.join("\n") %>+</code>++<p>+ <%= t(+ :mail_body_incoming_email_error_in_reply_to,+ received_at: format_time(@received_at),+ from_email: @mail.from.first+ )%>:+</p>++<blockquote>+ <%= @incoming_text %>+</blockquote>diff --git a/app/views/user_mailer/incoming_email_error.text.erb b/app/views/user_mailer/incoming_email_error.text.erbnew file mode 100644index 00000000000..6a651a8f2a0--- /dev/null+++ b/app/views/user_mailer/incoming_email_error.text.erb@@ -0,0 +1,42 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2022 the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See COPYRIGHT and LICENSE files for more details.++++#%>++<%= t(:mail_body_incoming_email_error) %>++<%= t(:mail_body_incoming_email_error_logs) %>:++<%= @logs.join("\n") %>++<%= t(+ :mail_body_incoming_email_error_in_reply_to,+ received_at: format_time(@received_at),+ from_email: @mail.from.first+)%>:++<%= @quote %>diff --git a/config/constants/settings/definitions.rb b/config/constants/settings/definitions.rbindex 4cc23a3c750..769d6076f60 100644--- a/config/constants/settings/definitions.rb+++ b/config/constants/settings/definitions.rb@@ -683,6 +683,8 @@ Settings::Definition.define do},writable: false+ add :report_incoming_email_errors, default: true+add :repositories_automatic_managed_vendor,default: nil,format: :string,diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 021b99f3389..e6fc01091f0 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2074,6 +2074,9 @@ en:mail_body_backup_token_info: The previous token is no longer valid.mail_body_backup_waiting_period: The new token will be enabled in %{hours} hours.mail_body_backup_token_warning: If this wasn't you, login to OpenProject immediately and reset it again.+ mail_body_incoming_email_error: The email you sent to OpenProject could not be processed.+ mail_body_incoming_email_error_in_reply_to: "At %{received_at} %{from_email} wrote"+ mail_body_incoming_email_error_logs: "Logs"mail_body_lost_password: "To change your password, click on the following link:"mail_body_register: "Welcome to %{app_title}. Please activate your account by clicking on this link:"mail_body_register_header_title: "Project member invitation email"@@ -2092,6 +2095,7 @@ en:mail_subject_account_activation_request: "%{value} account activation request"mail_subject_backup_ready: "Your backup is ready"mail_subject_backup_token_reset: "Backup token reset"+ mail_subject_incoming_email_error: "An email you sent to OpenProject could not be processed"mail_subject_lost_password: "Your %{value} password"mail_subject_register: "Your %{value} account activation"mail_subject_reminder: "%{count} work package(s) due in the next %{days} days"diff --git a/spec/controllers/activities_controller_spec.rb b/spec/controllers/activities_controller_spec.rbindex 310da190416..32ee5dcc114 100644--- a/spec/controllers/activities_controller_spec.rb+++ b/spec/controllers/activities_controller_spec.rb@@ -50,7 +50,7 @@ describe ActivitiesController, type: :controller dolet!(:journal) docreate(:work_package_journal,journable_id: work_package.id,- created_at: 3.days.ago.to_date.to_s(:db),+ created_at: 3.days.ago.to_date.to_fs(:db),version: Journal.maximum(:version) + 1,data: build(:journal_work_package_journal,subject: work_package.subject,diff --git a/spec/features/work_packages/edit_on_assign_version_permission_spec.rb b/spec/features/work_packages/edit_on_assign_version_permission_spec.rbindex 37dcd1bd5e7..ffcda11bd86 100644--- a/spec/features/work_packages/edit_on_assign_version_permission_spec.rb+++ b/spec/features/work_packages/edit_on_assign_version_permission_spec.rb@@ -22,7 +22,7 @@ describe 'edit work package', js: true doauthor: current_user,project: project,type: type,- created_at: 5.days.ago.to_date.to_s(:db))+ created_at: 5.days.ago.to_date.to_fs(:db))endlet(:status) { work_package.status }diff --git a/spec/features/work_packages/edit_work_package_spec.rb b/spec/features/work_packages/edit_work_package_spec.rbindex 9388b56834f..672a1fd6e20 100644--- a/spec/features/work_packages/edit_work_package_spec.rb+++ b/spec/features/work_packages/edit_work_package_spec.rb@@ -53,10 +53,10 @@ describe 'edit work package', js: true doauthor: dev,project: project,type: type,- created_at: 5.days.ago.to_date.to_s(:db))+ created_at: 5.days.ago.to_date.to_fs(:db))note_journal = work_package.journals.last- note_journal.update_column(:created_at, 5.days.ago.to_date.to_s(:db))+ note_journal.update_column(:created_at, 5.days.ago.to_date.to_fs(:db))work_packageenddiff --git a/spec/features/work_packages/tabs/activity_notifications_spec.rb b/spec/features/work_packages/tabs/activity_notifications_spec.rbindex cd3ec139c23..34f2be00874 100644--- a/spec/features/work_packages/tabs/activity_notifications_spec.rb+++ b/spec/features/work_packages/tabs/activity_notifications_spec.rb@@ -8,7 +8,7 @@ describe 'Activity tab notifications', js: true, selenium: true doshared_let(:work_package) dowork_package = create(:work_package,project: project,- created_at: 5.days.ago.to_date.to_s(:db))+ created_at: 5.days.ago.to_date.to_fs(:db))work_package.update({ journal_notes: 'First comment on this wp.',updated_at: 5.days.ago.to_date.to_s })diff --git a/spec/features/work_packages/tabs/activity_revisions_spec.rb b/spec/features/work_packages/tabs/activity_revisions_spec.rbindex 928be0fb914..f6460c327dd 100644--- a/spec/features/work_packages/tabs/activity_revisions_spec.rb+++ b/spec/features/work_packages/tabs/activity_revisions_spec.rb@@ -15,7 +15,7 @@ describe 'Activity tab', js: true, selenium: true dolet!(:work_package) dowork_package = create(:work_package,project: project,- created_at: 5.days.ago.to_date.to_s(:db),+ created_at: 5.days.ago.to_date.to_fs(:db),subject: initial_subject,journal_notes: initial_comment)@@ -39,7 +39,7 @@ describe 'Activity tab', js: true, selenium: true doalter_work_package_at(work_package,attributes: attributes,- at: 3.days.ago.to_date.to_s(:db),+ at: 3.days.ago.to_date.to_fs(:db),user: user)work_package.journals.last@@ -50,7 +50,7 @@ describe 'Activity tab', js: true, selenium: true doalter_work_package_at(work_package,attributes: attributes,- at: 1.days.ago.to_date.to_s(:db),+ at: 1.day.ago.to_date.to_fs(:db),user: create(:admin))work_package.journals.last@@ -66,7 +66,7 @@ describe 'Activity tab', js: true, selenium: true dochangeset = build(:changeset,comments: 'A comment on a changeset',- committed_on: 2.days.ago.to_date.to_s(:db),+ committed_on: 2.days.ago.to_date.to_fs(:db),repository: repo,committer: '[email protected]')diff --git a/spec/features/work_packages/tabs/activity_tab_spec.rb b/spec/features/work_packages/tabs/activity_tab_spec.rbindex 3d2fb1e22ed..ad3a0443315 100644--- a/spec/features/work_packages/tabs/activity_tab_spec.rb+++ b/spec/features/work_packages/tabs/activity_tab_spec.rb@@ -43,7 +43,7 @@ describe 'Activity tab', js: true, selenium: true dolet!(:work_package) dowork_package = create(:work_package,project: project,- created_at: 5.days.ago.to_date.to_s(:db),+ created_at: 5.days.ago.to_date.to_fs(:db),subject: initial_subject,journal_notes: initial_comment)@@ -67,7 +67,7 @@ describe 'Activity tab', js: true, selenium: true doalter_work_package_at(work_package,attributes: attributes,- at: 3.days.ago.to_date.to_s(:db),+ at: 3.days.ago.to_date.to_fs(:db),user: user)work_package.journals.last@@ -78,7 +78,7 @@ describe 'Activity tab', js: true, selenium: true doalter_work_package_at(work_package,attributes: attributes,- at: 1.day.ago.to_date.to_s(:db),+ at: 1.day.ago.to_date.to_fs(:db),user: create(:admin))work_package.journals.lastdiff --git a/spec/features/work_packages/work_package_workflow_form_spec.rb b/spec/features/work_packages/work_package_workflow_form_spec.rbindex bb005bbe892..81e781d153c 100644--- a/spec/features/work_packages/work_package_workflow_form_spec.rb+++ b/spec/features/work_packages/work_package_workflow_form_spec.rb@@ -50,7 +50,7 @@ describe 'Work package transitive status workflows', js: true dowork_package = create :work_package,project: project,type: type,- created_at: 5.days.ago.to_date.to_s(:db)+ created_at: 5.days.ago.to_date.to_fs(:db)note_journal = work_package.journals.lastnote_journal.update(created_at: 5.days.ago.to_date.to_s)diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rbindex c0b40d5f85e..e68f76d4a67 100644--- a/spec/mailers/user_mailer_spec.rb+++ b/spec/mailers/user_mailer_spec.rb@@ -230,6 +230,57 @@ describe UserMailer, type: :mailer doendend+ describe '#incoming_email_error' do+ let(:logs) { ['info: foo', 'error: bar'] }+ let(:recipient) { user }+ let(:current_time) { "2022-11-03 9:15".to_time }+ let(:incoming_email) do+ Mail.new(subject: mail_subject, message_id:, body:, from:)+ end++ let(:mail_subject) { 'New work package 42' }+ let(:message_id) { '<000501c8d452$a95cd7e0$0a00a8c0@osiris>' }+ let(:from) { '[email protected]' }+ let(:body) { "Project: demo-project" }++ let(:outgoing_email) { deliveries.first }++ before do+ described_class+ .incoming_email_error(user, incoming_email, logs)+ .deliver_now+ end++ it_behaves_like 'mail is sent' do+ it "references the incoming email's subject in its own" do+ expect(outgoing_email.subject).to eql "Re: #{mail_subject}"+ end++ it "it's a reply to the incoming email" do+ expect(message_id).to include outgoing_email.in_reply_to+ expect(message_id).to include outgoing_email.references+ end++ it "contains the incoming email's quoted content" do+ expect(html_body).to include body+ end++ it 'contains the date the mail was received' do+ expect(html_body).to include "11/03/2022 09:15 AM"+ end++ it 'contains the email address from which the email was sent' do+ expect(html_body).to include from+ end++ it 'contains the logs' do+ logs.each do |log|+ expect(html_body).to include log+ end+ end+ end+ end+describe '#news_added' dolet(:news) { build_stubbed(:news) }diff --git a/spec/models/mail_handler_spec.rb b/spec/models/mail_handler_spec.rbindex 38ad4113e2a..5021ade0e93 100644--- a/spec/models/mail_handler_spec.rb+++ b/spec/models/mail_handler_spec.rb@@ -39,6 +39,10 @@ describe MailHandler, type: :model do# there is a default work package priority to save any work packagespriority_lowanno_user++ allow(UserMailer)+ .to receive(:incoming_email_error)+ .and_return instance_double(ActionMailer::MessageDelivery, deliver_later: nil)endafter do@@ -338,6 +342,12 @@ describe MailHandler, type: :model doendend.to change(Notification.where(recipient: user), :count).by(1)end++ it 'does not send an error reply email' do+ subject # send mail++ expect(UserMailer).not_to have_received(:incoming_email_error)+ endendcontext 'in given project with a default type' do@@ -387,28 +397,74 @@ describe MailHandler, type: :model doend.to change(User, :count).by(1)end- it 'rejects if unknown_user=accept and permission check is present' do- expected =+ context 'with unknown_user=default' do+ let(:results) { [] }++ before do+ results << submit_email(+ 'ticket_by_unknown_user.eml',+ issue: { project: project.identifier },+ unknown_user: nil+ )+ end++ it "ignores the email" do+ expect(results).to eq [false]+ end++ it "does not respond with an error email" do+ expect(UserMailer).not_to have_received(:incoming_email_error)+ end+ end++ context 'with unknown_user=accept and permision check present' do+ let(:expected) do'MailHandler: work_package could not be created by Anonymous due to ' \'#["may not be accessed.", ' \'"Type was attempted to be written but is not writable.", ' \'"Project was attempted to be written but is not writable.", ' \'"Subject was attempted to be written but is not writable.", ' \'"Description was attempted to be written but is not writable."]'+ end- allow(Rails.logger)- .to receive(:error)- .with(expected)+ let(:results) { [] }- result = submit_email 'ticket_by_unknown_user.eml',- issue: { project: project.identifier },- unknown_user: 'accept'+ before do+ allow(Rails.logger).to receive(:error).with(expected)++ results << submit_email(+ 'ticket_by_unknown_user.eml',+ issue: { project: project.identifier },+ unknown_user: 'accept'+ )+ end- expect(result).to eq false+ it 'rejects the email' do+ expect(results).to eq [false]+ end++ it 'logs the error' do+ expect(Rails.logger).to have_received(:error).with(expected)+ end- expect(Rails.logger)- .to have_received(:error)- .with(expected)+ context 'with report_incoming_email_errors true (default)' do+ it 'responds with an error email' do+ expect(UserMailer).to have_received(:incoming_email_error) do |user, mail, logs|+ expect(user).to eq anno_user+ expect(mail.subject).to eq "Ticket by unknown user"+ expect(logs).to eq [expected.sub(/^MailHandler/, "error")]+ end+ end+ end++ context(+ 'with report_incoming_email_errors false',+ with_settings: { report_incoming_email_errors: false }+ ) do+ it 'does not respond with an error email' do+ expect(UserMailer).not_to have_received(:incoming_email_error)+ end+ endendit 'accepts if unknown_user=accept and no_permission_check' do@@ -446,6 +502,12 @@ describe MailHandler, type: :model doexpect { subject }.not_to(change { WorkPackage.count })end++ it 'does not result in an error email response' do+ subject # send email++ expect(UserMailer).not_to have_received(:incoming_email_error)+ endendcontext 'wp with status' dodiff --git a/spec_legacy/fixtures/messages.yml b/spec_legacy/fixtures/messages.ymlindex 2987e72edaf..cfe6e878378 100644--- a/spec_legacy/fixtures/messages.yml+++ b/spec_legacy/fixtures/messages.yml@@ -72,8 +72,8 @@ messages_004:parent_id:forum_id: 1messages_005:- created_at: <%= 3.days.ago.to_date.to_s(:db) %>- updated_at: <%= 3.days.ago.to_date.to_s(:db) %>+ created_at: <%= 3.days.ago.to_date.to_fs(:db) %>+ updated_at: <%= 3.days.ago.to_date.to_fs(:db) %>subject: 'RE: post 2'id: 5replies_count: 0@@ -83,8 +83,8 @@ messages_005:parent_id: 4forum_id: 1messages_006:- created_at: <%= 2.days.ago.to_date.to_s(:db) %>- updated_at: <%= 2.days.ago.to_date.to_s(:db) %>+ created_at: <%= 2.days.ago.to_date.to_fs(:db) %>+ updated_at: <%= 2.days.ago.to_date.to_fs(:db) %>subject: 'RE: post 2'id: 6replies_count: 0@@ -94,8 +94,8 @@ messages_006:parent_id: 4forum_id: 1messages_007:- created_at: <%= 2.days.ago.to_date.to_s(:db) %>- updated_at: <%= 2.days.ago.to_date.to_s(:db) %>+ created_at: <%= 2.days.ago.to_date.to_fs(:db) %>+ updated_at: <%= 2.days.ago.to_date.to_fs(:db) %>subject: 'Message on a private project'id: 7replies_count: 0diff --git a/spec_legacy/fixtures/versions.yml b/spec_legacy/fixtures/versions.ymlindex 2cc8e725fb8..69b5e308608 100644--- a/spec_legacy/fixtures/versions.yml+++ b/spec_legacy/fixtures/versions.yml@@ -44,7 +44,7 @@ versions_002:updated_at: 2006-07-19 21:00:33 +02:00id: 2description: Stable release- effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>+ effective_date: <%= 20.day.from_now.to_date.to_fs(:db) %>status: lockedsharing: 'none'versions_003:diff --git a/spec_legacy/fixtures/work_packages.yml b/spec_legacy/fixtures/work_packages.ymlindex b166e75f97b..c116a4d649a 100644--- a/spec_legacy/fixtures/work_packages.yml+++ b/spec_legacy/fixtures/work_packages.yml@@ -28,9 +28,9 @@---issues_001:- created_at: <%= 3.days.ago.to_date.to_s(:db) %>+ created_at: <%= 3.days.ago.to_date.to_fs(:db) %>project_id: 1- updated_at: <%= 1.day.ago.to_date.to_s(:db) %>+ updated_at: <%= 1.day.ago.to_date.to_fs(:db) %>priority_id: 4subject: Can't print recipesid: 1@@ -41,8 +41,8 @@ issues_001:assigned_to_id:author_id: 2status_id: 1- start_date: <%= 1.day.ago.to_date.to_s(:db) %>- due_date: <%= 10.day.from_now.to_date.to_s(:db) %>+ start_date: <%= 1.day.ago.to_date.to_fs(:db) %>+ due_date: <%= 10.day.from_now.to_date.to_fs(:db) %>lock_version: 3issues_002:created_at: 2006-07-19 21:04:21 +02:00@@ -58,7 +58,7 @@ issues_002:assigned_to_id: 3author_id: 2status_id: 2- start_date: <%= 2.day.ago.to_date.to_s(:db) %>+ start_date: <%= 2.day.ago.to_date.to_fs(:db) %>due_date:lock_version: 3done_ratio: 30@@ -76,12 +76,12 @@ issues_003:assigned_to_id: 3author_id: 2status_id: 1- start_date: <%= 15.day.ago.to_date.to_s(:db) %>- due_date: <%= 5.day.ago.to_date.to_s(:db) %>+ start_date: <%= 15.day.ago.to_date.to_fs(:db) %>+ due_date: <%= 5.day.ago.to_date.to_fs(:db) %>issues_004:- created_at: <%= 5.days.ago.to_date.to_s(:db) %>+ created_at: <%= 5.days.ago.to_date.to_fs(:db) %>project_id: 2- updated_at: <%= 2.days.ago.to_date.to_s(:db) %>+ updated_at: <%= 2.days.ago.to_date.to_fs(:db) %>priority_id: 4subject: Issue on project 2id: 4@@ -93,9 +93,9 @@ issues_004:author_id: 2status_id: 1issues_005:- created_at: <%= 5.days.ago.to_date.to_s(:db) %>+ created_at: <%= 5.days.ago.to_date.to_fs(:db) %>project_id: 3- updated_at: <%= 2.days.ago.to_date.to_s(:db) %>+ updated_at: <%= 2.days.ago.to_date.to_fs(:db) %>priority_id: 4subject: Subproject issueid: 5@@ -107,9 +107,9 @@ issues_005:author_id: 2status_id: 1issues_006:- created_at: <%= 1.minute.ago.to_date.to_s(:db) %>+ created_at: <%= 1.minute.ago.to_date.to_fs(:db) %>project_id: 5- updated_at: <%= 1.minute.ago.to_date.to_s(:db) %>+ updated_at: <%= 1.minute.ago.to_date.to_fs(:db) %>priority_id: 4subject: Issue of a private subprojectid: 6@@ -120,12 +120,12 @@ issues_006:assigned_to_id:author_id: 2status_id: 1- start_date: <%= Date.today.to_s(:db) %>- due_date: <%= 1.days.from_now.to_date.to_s(:db) %>+ start_date: <%= Date.today.to_fs(:db) %>+ due_date: <%= 1.days.from_now.to_date.to_fs(:db) %>issues_007:- created_at: <%= 10.days.ago.to_date.to_s(:db) %>+ created_at: <%= 10.days.ago.to_date.to_fs(:db) %>project_id: 1- updated_at: <%= 10.days.ago.to_date.to_s(:db) %>+ updated_at: <%= 10.days.ago.to_date.to_fs(:db) %>priority_id: 5subject: Issue due todayid: 7@@ -136,12 +136,12 @@ issues_007:assigned_to_id:author_id: 2status_id: 1- start_date: <%= 10.days.ago.to_s(:db) %>- due_date: <%= Date.today.to_s(:db) %>+ start_date: <%= 10.days.ago.to_fs(:db) %>+ due_date: <%= Date.today.to_fs(:db) %>issues_008:- created_at: <%= 10.days.ago.to_date.to_s(:db) %>+ created_at: <%= 10.days.ago.to_date.to_fs(:db) %>project_id: 1- updated_at: <%= 10.days.ago.to_date.to_s(:db) %>+ updated_at: <%= 10.days.ago.to_date.to_fs(:db) %>priority_id: 5subject: Closed issueid: 8@@ -155,9 +155,9 @@ issues_008:start_date:due_date:issues_009:- created_at: <%= 1.minute.ago.to_date.to_s(:db) %>+ created_at: <%= 1.minute.ago.to_date.to_fs(:db) %>project_id: 5- updated_at: <%= 1.minute.ago.to_date.to_s(:db) %>+ updated_at: <%= 1.minute.ago.to_date.to_fs(:db) %>priority_id: 5subject: Blocked Issueid: 9@@ -168,12 +168,12 @@ issues_009:assigned_to_id:author_id: 2status_id: 1- start_date: <%= Date.today.to_s(:db) %>- due_date: <%= 1.days.from_now.to_date.to_s(:db) %>+ start_date: <%= Date.today.to_fs(:db) %>+ due_date: <%= 1.days.from_now.to_date.to_fs(:db) %>issues_010:- created_at: <%= 1.minute.ago.to_date.to_s(:db) %>+ created_at: <%= 1.minute.ago.to_date.to_fs(:db) %>project_id: 5- updated_at: <%= 1.minute.ago.to_date.to_s(:db) %>+ updated_at: <%= 1.minute.ago.to_date.to_fs(:db) %>priority_id: 5subject: Issue Doing the Blockingid: 10@@ -184,12 +184,12 @@ issues_010:assigned_to_id:author_id: 2status_id: 1- start_date: <%= Date.today.to_s(:db) %>- due_date: <%= 1.days.from_now.to_date.to_s(:db) %>+ start_date: <%= Date.today.to_fs(:db) %>+ due_date: <%= 1.days.from_now.to_date.to_fs(:db) %>issues_011:- created_at: <%= 3.days.ago.to_date.to_s(:db) %>+ created_at: <%= 3.days.ago.to_date.to_fs(:db) %>project_id: 1- updated_at: <%= 1.day.ago.to_date.to_s(:db) %>+ updated_at: <%= 1.day.ago.to_date.to_fs(:db) %>priority_id: 5subject: Closed issue on a closed versionid: 11@@ -200,12 +200,12 @@ issues_011:assigned_to_id:author_id: 2status_id: 5- start_date: <%= 1.day.ago.to_date.to_s(:db) %>+ start_date: <%= 1.day.ago.to_date.to_fs(:db) %>due_date:issues_012:- created_at: <%= 3.days.ago.to_date.to_s(:db) %>+ created_at: <%= 3.days.ago.to_date.to_fs(:db) %>project_id: 1- updated_at: <%= 1.day.ago.to_date.to_s(:db) %>+ updated_at: <%= 1.day.ago.to_date.to_fs(:db) %>priority_id: 5subject: Closed issue on a locked versionid: 12@@ -216,12 +216,12 @@ issues_012:assigned_to_id:author_id: 3status_id: 5- start_date: <%= 1.day.ago.to_date.to_s(:db) %>+ start_date: <%= 1.day.ago.to_date.to_fs(:db) %>due_date:issues_013:- created_at: <%= 5.days.ago.to_date.to_s(:db) %>+ created_at: <%= 5.days.ago.to_date.to_fs(:db) %>project_id: 3- updated_at: <%= 2.days.ago.to_date.to_s(:db) %>+ updated_at: <%= 2.days.ago.to_date.to_fs(:db) %>priority_id: 4subject: Subproject issue twoid: 13diff --git a/spec_legacy/unit/mail_handler_spec.rb b/spec_legacy/unit/mail_handler_spec.rbindex a445b5cff38..f637792d137 100644--- a/spec_legacy/unit/mail_handler_spec.rb+++ b/spec_legacy/unit/mail_handler_spec.rb@@ -27,7 +27,7 @@#++require_relative '../legacy_spec_helper'-describe MailHandler, type: :model do+describe MailHandler, type: :model, with_settings: { report_incoming_email_errors: false } dofixtures :allFIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler'