Skip to content

Commit

Permalink
Merge branch 'release/12.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed May 17, 2022
2 parents 7eaca08 + 4557cb9 commit 16c00f5
Show file tree
Hide file tree
Showing 17 changed files with 266 additions and 51 deletions.
7 changes: 7 additions & 0 deletions .pkgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ targets:
ubuntu-20.04:
<<: *debian9
centos-7: &centos7
env:
- BUNDLE_BUILD__PG="--with-pg-config=/usr/pgsql-13/bin/pg_config"
- NODE_ENV=production
- NPM_CONFIG_PRODUCTION=false
dependencies:
- epel-release
- ImageMagick
- unzip
- poppler-utils
centos-8:
<<: *centos7
env:
- NODE_ENV=production
- NPM_CONFIG_PRODUCTION=false
sles-12:
build_dependencies:
- sqlite3-devel
Expand Down
33 changes: 0 additions & 33 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,36 +173,3 @@ def header_host_value
host
end
end

##
# Interceptors
#
# These are registered in config/initializers/register_mail_interceptors.rb
#
# Unfortunately, this results in changes on the interceptor classes during development mode
# not being reflected until a server restart.

class DefaultHeadersInterceptor
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

class DoNotSendMailsWithoutReceiverInterceptor
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
17 changes: 17 additions & 0 deletions app/mailers/interceptors/default_headers.rb
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 app/mailers/interceptors/do_not_send_mails_without_recipient.rb
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
2 changes: 1 addition & 1 deletion config/constants/settings/definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@

add :smtp_openssl_verify_mode,
format: :string,
value: "none",
value: "peer",
allowed: %w[none peer client_once fail_if_no_peer_cert],
writable: false

Expand Down
8 changes: 3 additions & 5 deletions config/initializers/register_mail_interceptors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
# Register interceptors defined in app/mailers/user_mailer.rb
# Do this here, so they aren't registered multiple times due to reloading in development mode.

Rails.application.config.action_mailer.interceptors = [
"DefaultHeadersInterceptor",
# following needs to be the last interceptor
"DoNotSendMailsWithoutReceiverInterceptor"
]
ApplicationMailer.register_interceptor Interceptors::DefaultHeaders
# following needs to be the last interceptor
ApplicationMailer.register_interceptor Interceptors::DoNotSendMailsWithoutRecipient
2 changes: 1 addition & 1 deletion config/locales/crowdin/js-fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ fr:
all: 'Tous les projets'
selected: 'Uniquement la sélection'
search_placeholder: 'Rechercher un projet...'
include_subprojects: 'inclure tous les sous-projets'
include_subprojects: 'Inclure tous les sous-projets'
tooltip:
include_all_selected: 'Inclure tous les sous-projets est actuellement sélectionné.'
current_project: 'Ceci est le projet dans lequel vous vous trouvez actuellement.'
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/js-ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ru:
button_save: "Сохранить"
button_settings: "Настройки"
button_uncheck_all: "Снять все отметки"
button_update: "Обновление"
button_update: "Обновить"
button_export-pdf: "Скачать PDF"
button_export-atom: "Скачать Atom"
button_create: "Создать"
Expand Down
2 changes: 1 addition & 1 deletion docs/bim-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: User guide for the OpenProject BIM Edition.
robots: index, follow
keywords: BIM user guide
---
# BIM user guide
# BIM guide

Welcome to the OpenProject user guide for Building Information Modeling (BIM) with OpenProject.

Expand Down
4 changes: 2 additions & 2 deletions docs/release-notes/12-1-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ The release contains several bug fixes and we recommend updating to the newest v

## Settings regression

OpenProject introduced a larger refactoring of the app settings to clean up
OpenProject introduced a larger refactoring of the app settings to clean up
the distinction between ENV settings and database-based settings.

Unfortunately, that introduced some constraints that caused the following bugs in downstream products,
warranting another patch level level release. We're sorry for the inconvenience caused.
warranting another patch level release. We're sorry for the inconvenience caused.

If you experience bugs in installing or using OpenProject, please help us by reporting them to our community.
To read how to do this, please see [reporting a bug in OpenProject](https://www.openproject.org/docs/development/report-a-bug/).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export class OpContextMenuTrigger extends OpContextMenuHandler implements AfterV

protected items:OpContextMenuItem[] = [];

constructor(readonly elementRef:ElementRef,
readonly opContextMenu:OPContextMenuService) {
constructor(
readonly elementRef:ElementRef,
readonly opContextMenu:OPContextMenuService,
) {
super(opContextMenu);
}

Expand All @@ -22,16 +24,13 @@ export class OpContextMenuTrigger extends OpContextMenuHandler implements AfterV
// Open by clicking the element
this.$element.on('click', (evt:JQuery.TriggeredEvent) => {
evt.preventDefault();
evt.stopPropagation();

// When clicking the same trigger twice, close the element instead.
if (this.opContextMenu.isActive(this)) {
this.opContextMenu.close();
return false;
} else {
this.open(evt);
}

this.open(evt);
return false;
});

// Open with keyboard combination as well
Expand Down
4 changes: 4 additions & 0 deletions lib/open_project/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def reload_smtp_settings!

ActionMailer::Base.smtp_settings[:enable_starttls_auto] = Setting.smtp_enable_starttls_auto?
ActionMailer::Base.smtp_settings[:ssl] = Setting.smtp_ssl?

Setting.smtp_openssl_verify_mode.tap do |mode|
ActionMailer::Base.smtp_settings[:openssl_verify_mode] = mode unless mode.nil?
end
end

def cache_parameters
Expand Down
25 changes: 25 additions & 0 deletions lib/open_project/patches/mail_smtp_start_tls_auto_fix.rb
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
9 changes: 9 additions & 0 deletions packaging/setup
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ cp -f packaging/.npmrc .npmrc

# replace every occurrence of _APP_NAME_ with the corresponding application name we're packaging
find packaging/ -type f -print0 | xargs -0 sed -i "s|_APP_NAME_|${APP_NAME}|"

# Install newer version of postgresql libs for centos7
if [ "$TARGET" = 'el:7' ]; then
sudo yum remove -y postgresql-devel

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y centos-release-scl-rh
sudo yum install -y postgresql13-devel
fi
4 changes: 4 additions & 0 deletions spec/lib/open_project/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
port: 25,
domain: 'example.com',
enable_starttls_auto: true,
openssl_verify_mode: 'peer',
ssl: false)
end
end
Expand All @@ -164,6 +165,7 @@
port: 25,
domain: 'example.com',
enable_starttls_auto: false,
openssl_verify_mode: 'peer',
ssl: true)
end
end
Expand Down Expand Up @@ -191,6 +193,7 @@
user_name: 'username',
password: 'p4ssw0rd',
enable_starttls_auto: true,
openssl_verify_mode: 'peer',
ssl: false)
end
end
Expand Down Expand Up @@ -218,6 +221,7 @@
user_name: 'username',
password: 'p4ssw0rd',
enable_starttls_auto: false,
openssl_verify_mode: 'peer',
ssl: true)
end
end
Expand Down
Loading

0 comments on commit 16c00f5

Please sign in to comment.