Skip to content

Commit 4772199

Browse files
Release OpenProject 12.2.1
2 parents b31b7e8 + 67bb9e0 commit 4772199

File tree

202 files changed

+1209
-1087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+1209
-1087
lines changed

.github/CODEOWNERS

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Frontend rules
2+
*.js @opf/frontend
3+
*.ts @opf/frontend
4+
5+
# Backend rules
6+
*.rb @opf/backend
7+
8+
# docs rules
9+
/docs/ @opf/doc-writers
10+
11+
# Tech doc rules
12+
/docs/development @opf/tech-writers
13+
/docs/installation-and-operations @opf/tech-writers
14+
/docs/system-admin-guide @opf/tech-writers
15+
/docs/api @opf/tech-writers @opf/backend

app/helpers/static_links_helper.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,13 @@ def static_link_to(key, label: nil)
3737
class: 'openproject--static-link',
3838
target: '_blank', rel: 'noopener'
3939
end
40+
41+
##
42+
# Link to the correct installation guides for the current selected method
43+
def installation_guide_link
44+
val = OpenProject::Configuration.installation_type
45+
link = OpenProject::Static::Links.links[:"#{val}_installation"] || OpenProject::Static::Links.links[:installation_guides]
46+
47+
link[:href]
48+
end
4049
end

app/helpers/warning_bar_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def render_host_and_protocol_mismatch?
4040
end
4141

4242
def setting_protocol_mismatched?
43-
request.ssl? != OpenProject::Configuration.secure_connection?
43+
request.ssl? != OpenProject::Configuration.https?
4444
end
4545

4646
def setting_hostname_mismatched?

app/models/journal.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ def previous
101101
predecessor
102102
end
103103

104+
def successor
105+
@successor ||= self.class
106+
.where(journable_type:, journable_id:)
107+
.where("#{self.class.table_name}.version > ?", version)
108+
.order(version: :asc)
109+
.first
110+
end
111+
104112
def noop?
105113
(!notes || notes&.empty?) && get_changes.empty?
106114
end

app/models/setting/aliases.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Aliases
3333
##
3434
# Restore the previous Setting.protocol now replaced by https?
3535
def protocol
36-
if OpenProject::Configuration.secure_connection?
36+
if OpenProject::Configuration.https?
3737
'https'
3838
else
3939
'http'

app/services/journals/create_service.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,22 +177,25 @@ def create_journal_sql(predecessor, notes)
177177
def cleanup_predecessor_data(predecessor)
178178
cleanup_predecessor(predecessor,
179179
data_table_name,
180-
:id)
180+
:id,
181+
:data_id)
181182
end
182183

183184
def cleanup_predecessor_attachable(predecessor)
184185
cleanup_predecessor(predecessor,
185186
'attachable_journals',
186-
:journal_id)
187+
:journal_id,
188+
:id)
187189
end
188190

189191
def cleanup_predecessor_customizable(predecessor)
190192
cleanup_predecessor(predecessor,
191193
'customizable_journals',
192-
:journal_id)
194+
:journal_id,
195+
:id)
193196
end
194197

195-
def cleanup_predecessor(predecessor, table_name, column)
198+
def cleanup_predecessor(predecessor, table_name, column, referenced_id)
196199
return "SELECT 1" unless predecessor
197200

198201
sql = <<~SQL
@@ -204,7 +207,7 @@ def cleanup_predecessor(predecessor, table_name, column)
204207
SQL
205208

206209
sanitize sql,
207-
column => predecessor.id
210+
column => predecessor.send(referenced_id)
208211
end
209212

210213
def update_or_insert_journal_sql(predecessor, notes)

app/views/warning_bar/_host_and_protocol_mismatch.html.erb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
<% if setting_protocol_mismatched? %>
55
<p>
6-
<strong><%= t 'warning_bar.protocol_mismatch.title' %></strong>
6+
<strong><%= t 'warning_bar.https_mismatch.title' %></strong>
77
<br/>
8-
<%= t 'warning_bar.protocol_mismatch.text_html',
8+
<%= t 'warning_bar.https_mismatch.text_html',
99
set_protocol: Setting.protocol,
1010
actual_protocol: request.ssl? ? 'https' : 'http',
11-
setting_path: admin_settings_general_path
11+
setting_value: request.ssl? ? 'OPENPROJECT_HTTPS=true' : 'OPENPROJECT_HTTPS=false',
12+
more_info_path: installation_guide_link
1213
%>
1314
</p>
1415
<% end %>

config/configuration.yml.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ default:
208208
#
209209
# rails_relative_url_root: ""
210210

211-
# whether to force ssl in production
212-
rails_force_ssl: false
213-
214211
# Absolute path to the directory where attachments are stored.
215212
# The default is the 'files' directory in your OpenProject instance.
216213
# Your OpenProject instance needs to have write permission on this

config/constants/settings/definition.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ def load_yaml(source)
381381
def cast(value)
382382
return nil if value.nil?
383383

384+
value = value.call if value.respond_to?(:call)
385+
384386
case format
385387
when :integer
386388
value.to_i
@@ -391,11 +393,7 @@ def cast(value)
391393
when :symbol
392394
value.to_sym
393395
else
394-
if value.respond_to?(:call)
395-
value.call
396-
else
397-
value
398-
end
396+
value
399397
end
400398
end
401399

config/constants/settings/definitions.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,16 +666,16 @@
666666
writable: false
667667

668668
# Assume we're running in an TLS terminated connection.
669-
# This does not affect HSTS, use +rails_force_ssl+ for that.
670669
add :https,
671670
format: :boolean,
672-
default: Rails.env.production?,
671+
default: -> { Rails.env.production? },
673672
writable: false
674673

675-
# Enable HTTPS and HSTS
676-
add :rails_force_ssl,
674+
# Allow disabling of HSTS headers and http -> https redirects
675+
# for non-localhost hosts
676+
add :hsts,
677677
format: :boolean,
678-
default: Rails.env.production?,
678+
default: true,
679679
writable: false
680680

681681
add :registration_footer,

0 commit comments

Comments
 (0)