Skip to content

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

Use compatible method with saas patch

Oliver Günther348b6fc69439
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 33ca1866184..c7b349bfebe 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -74,11 +74,6 @@ class ApplicationMailer < ActionMailer::Base
end
end
- def mail(headers = {}, &block)
- block ||= method(:default_formats_for_setting)
- super(headers, &block)
- end
-
# Sets a Message-ID header.
#
# While the value is set in here, email gateways such as postmark, unless instructed explicitly will assign
@@ -122,14 +117,20 @@ class ApplicationMailer < ActionMailer::Base
##
# Overwrite mailer method to prevent sending mails to locked users.
- def mail(to:, **args)
- raise ArgumentError, "Recipient needs to be instance of User" unless to.is_a?(User)
+ def mail(headers = {}, &block)
+ block ||= method(:default_formats_for_setting)
+ to = headers[:to]
+
+ if to
+ raise ArgumentError, "Recipient needs to be instance of User" unless to.is_a?(User)
- if to.locked?
- Rails.logger.info "Not sending #{action_name} mail to locked user #{to.id} (#{to.login})"
- else
- super(to: to.mail, **args)
+ if to.locked?
+ Rails.logger.info "Not sending #{action_name} mail to locked user #{to.id} (#{to.login})"
+ return
+ end
end
+
+ super(headers, &block)
end
def send_localized_mail(user)