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
adapt interface of mailer #perform to adhere to rails 6.2
ulferts9df4ede3cc12
diff --git a/app/workers/mailer_job.rb b/app/workers/mailer_job.rbindex f638cb16288..f76b98b730e 100644--- a/app/workers/mailer_job.rb+++ b/app/workers/mailer_job.rb@@ -38,10 +38,6 @@# as opposed to using `ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper`.# We want it to run in an `ApplicationJob` because of the shared setup required# such as reloading the mailer configuration and resetting the request store.-#-# This class is automatically used whenever you call-#-# UserMailer.method(*args).deliver_laterclass MailerJob < ApplicationJobqueue_as { ActionMailer::Base.deliver_later_queue_name }@@ -52,8 +48,8 @@ class MailerJob < ApplicationJob# retry_on will be ignoredrescue_from StandardError, with: :handle_exception_with_mailer_class- def perform(mailer, mail_method, delivery_method, *args)- mailer.constantize.public_send(mail_method, *args).send(delivery_method)+ def perform(mailer, mail_method, delivery, args:)+ mailer.constantize.public_send(mail_method, *args).send(delivery)endprivatediff --git a/lib/open_project/patches/delivery_job.rb b/lib/open_project/patches/delivery_job.rbnew file mode 100644index 00000000000..c6454c260bb--- /dev/null+++ b/lib/open_project/patches/delivery_job.rb@@ -0,0 +1,41 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 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-2017 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 docs/COPYRIGHT.rdoc for more details.+#++++# This patch adds our job status extension to background jobs carried out when mailing with+# perform_later.++module OpenProject+ module Patches+ module DeliveryJob+ #include ::JobStatus::ApplicationJobWithStatus+ end+ end+end++ActionMailer::MailDeliveryJob.send(:include, ::JobStatus::ApplicationJobWithStatus)+diff --git a/spec/models/news_spec.rb b/spec/models/news_spec.rbindex 9a282b75583..2c337635caa 100644--- a/spec/models/news_spec.rb+++ b/spec/models/news_spec.rb@@ -112,13 +112,13 @@ describe News, type: :model dowith_settings: { notified_events: %w(news_added) } doit 'sends email notifications when created' doFactoryBot.create(:user,- member_in_project: project,- member_through_role: role)+ member_in_project: project,+ member_through_role: role)project.members.reload- FactoryBot.create(:news, project: project)-- perform_enqueued_jobs+ perform_enqueued_jobs do+ FactoryBot.create(:news, project: project)+ endexpect(ActionMailer::Base.deliveries.size).to eq(1)endend