-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/12.1' into dev
- Loading branch information
Showing
17 changed files
with
266 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Interceptors | ||
class DefaultHeaders | ||
def self.delivering_email(mail) | ||
mail.headers(default_headers) | ||
end | ||
|
||
def self.default_headers | ||
{ | ||
'X-Mailer' => 'OpenProject', | ||
'X-OpenProject-Host' => Setting.host_name, | ||
'X-OpenProject-Site' => Setting.app_title, | ||
'Precedence' => 'bulk', | ||
'Auto-Submitted' => 'auto-generated' | ||
} | ||
end | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
app/mailers/interceptors/do_not_send_mails_without_recipient.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Interceptors | ||
class DoNotSendMailsWithoutRecipient | ||
def self.delivering_email(mail) | ||
receivers = [mail.to, mail.cc, mail.bcc] | ||
# the above fields might be empty arrays (if entries have been removed | ||
# by another interceptor) or nil, therefore checking for blank? | ||
mail.perform_deliveries = false if receivers.all?(&:blank?) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## | ||
# This is a fix for a new SMTP bug introduced with Ruby 3. | ||
# This can be removed once the official fix from the `mail` gem maintainers | ||
# has been released and the gem bumped by us. | ||
# | ||
# Details: https://community.openproject.org/projects/openproject/work_packages/42385/activity | ||
module OpenProject | ||
module Patches | ||
module MailSmtpStartTlsAutoHotfix | ||
def build_smtp_session | ||
super.tap do |smtp| | ||
smtp.disable_starttls if disable_starttls? | ||
end | ||
end | ||
|
||
def disable_starttls? | ||
settings[:enable_starttls_auto] == false && !settings[:enable_starttls] | ||
end | ||
end | ||
end | ||
end | ||
|
||
require 'mail' | ||
|
||
Mail::SMTP.prepend OpenProject::Patches::MailSmtpStartTlsAutoHotfix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.