Skip to content

Commit 7d9cc24

Browse files
committed
Release OpenProject 11.4.1
2 parents 4933a83 + e371833 commit 7d9cc24

File tree

94 files changed

+941
-607
lines changed

Some content is hidden

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

94 files changed

+941
-607
lines changed

.pkgr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ installer: https://github.com/pkgr/installer.git
4141
wizards:
4242
- https://github.com/pkgr/addon-legacy-installer.git
4343
- ./packaging/addons/openproject-edition
44-
- https://github.com/opf/addon-postgres
44+
- https://github.com/pkgr/addon-postgres
4545
- https://github.com/pkgr/addon-apache2.git
4646
- ./packaging/addons/repositories
4747
- https://github.com/pkgr/addon-smtp.git

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ gem 'escape_utils', '~> 1.0'
8585
# Syntax highlighting used in html-pipeline with rouge
8686
gem 'rouge', '~> 3.26.0'
8787
# HTML sanitization used for html-pipeline
88-
gem 'sanitize', '~> 5.2.1'
88+
gem 'sanitize', '~> 6.0.0'
8989
# HTML autolinking for mails and urls (replaces autolink)
9090
gem 'rinku', '~> 2.0.4'
9191
# Version parsing with semver

Gemfile.lock

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,6 @@ GEM
610610
nokogiri (1.12.5)
611611
mini_portile2 (~> 2.6.1)
612612
racc (~> 1.4)
613-
nokogumbo (2.0.5)
614-
nokogiri (~> 1.8, >= 1.8.4)
615613
octokit (4.21.0)
616614
faraday (>= 0.9)
617615
sawyer (~> 0.8.0, >= 0.5.3)
@@ -836,10 +834,9 @@ GEM
836834
json (~> 2.1)
837835
structured_warnings (~> 0.3)
838836
rubyzip (2.3.0)
839-
sanitize (5.2.3)
837+
sanitize (6.0.0)
840838
crass (~> 1.0.2)
841-
nokogiri (>= 1.8.0)
842-
nokogumbo (~> 2.0)
839+
nokogiri (>= 1.12.0)
843840
sassc (2.4.0)
844841
ffi (~> 1.9)
845842
sassc-rails (2.1.2)
@@ -1091,7 +1088,7 @@ DEPENDENCIES
10911088
ruby-prof
10921089
ruby-progressbar (~> 1.11.0)
10931090
rubytree (~> 1.0.0)
1094-
sanitize (~> 5.2.1)
1091+
sanitize (~> 6.0.0)
10951092
sassc-rails
10961093
secure_headers (~> 6.3.0)
10971094
selenium-webdriver (~> 3.14)

app/contracts/attachments/prepare_upload_contract.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,24 @@ class PrepareUploadContract < CreateContract
3737
def validate_direct_uploads_active
3838
errors.add :base, :not_available unless OpenProject::Configuration.direct_uploads?
3939
end
40+
41+
##
42+
# The browser hasn't given a specific content type.
43+
# So we don't check the content type here during the prepare_upload step yet.
44+
#
45+
# We'll do it again later in the FinishDirectUploadJob where the normal create contract
46+
# without this opt-out is used, and where a more specific content type may be
47+
# determined.
48+
def validate_content_type
49+
return if pending_content_type?
50+
51+
super
52+
end
53+
54+
def pending_content_type?
55+
return false unless OpenProject::Configuration.direct_uploads?
56+
57+
model.content_type == OpenProject::ContentTypeDetector::SENSIBLE_DEFAULT
58+
end
4059
end
4160
end

app/models/group_user.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ class GroupUser < ApplicationRecord
3232
belongs_to :group,
3333
touch: true
3434
belongs_to :user
35+
36+
validates_presence_of :group
37+
validates_presence_of :user
3538
end

app/services/attachments/set_prepared_attributes_service.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ def set_prepared_attributes(params)
5050
model.extend(OpenProject::ChangedBySystem)
5151
model.change_by_system do
5252
model.downloads = -1
53-
# Set a content type as the file is not present
54-
# The real content type will be set by FinishDirectUploadJob
55-
model.content_type = params[:content_type] || OpenProject::ContentTypeDetector::SENSIBLE_DEFAULT
53+
# Set a preliminary content type as the file is not present
54+
# The content type will be updated by the FinishDirectUploadJob if necessary.
55+
model.content_type = params[:content_type].presence || OpenProject::ContentTypeDetector::SENSIBLE_DEFAULT
5656
end
5757
end
5858

app/services/groups/update_service.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Groups::UpdateService < ::BaseServices::Update
3232
protected
3333

3434
def persist(call)
35-
removed_users = call.result.group_users.select(&:marked_for_destruction?).map(&:user)
35+
removed_users = groups_removed_users(call.result)
3636
member_roles = member_roles_to_prune(removed_users)
3737
project_ids = member_roles.pluck(:project_id)
3838
member_role_ids = member_roles.pluck(:id)
@@ -59,13 +59,19 @@ def after_perform(call)
5959
call
6060
end
6161

62+
def groups_removed_users(group)
63+
group.group_users.select(&:marked_for_destruction?).map(&:user).compact
64+
end
65+
6266
def remove_member_roles(member_role_ids)
6367
::Groups::CleanupInheritedRolesService
6468
.new(model, current_user: user)
6569
.call(member_role_ids: member_role_ids)
6670
end
6771

6872
def member_roles_to_prune(users)
73+
return MemberRole.none if users.empty?
74+
6975
MemberRole
7076
.includes(member: :member_roles)
7177
.where(inherited_from: model.members.joins(:member_roles).select('member_roles.id'))

app/workers/attachments/finish_direct_upload_job.rb

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,53 @@ def perform(attachment_id)
4242
return Rails.logger.error("File for attachment #{attachment_id} was not uploaded.")
4343
end
4444

45-
begin
46-
set_attributes_from_file(attachment, local_file)
47-
save_attachment(attachment)
48-
journalize_container(attachment)
49-
ensure
50-
File.unlink(local_file.path) if File.exist?(local_file.path)
45+
User.execute_as(attachment.author) do
46+
attach_uploaded_file(attachment, local_file)
5147
end
5248
end
5349

5450
private
5551

52+
def attach_uploaded_file(attachment, local_file)
53+
set_attributes_from_file(attachment, local_file)
54+
validate_attachment(attachment)
55+
save_attachment(attachment)
56+
journalize_container(attachment)
57+
attachment_created_event(attachment)
58+
rescue StandardError => e
59+
::OpenProject.logger.error e
60+
attachment.destroy
61+
ensure
62+
File.unlink(local_file.path) if File.exist?(local_file.path)
63+
end
64+
5665
def set_attributes_from_file(attachment, local_file)
57-
attachment.downloads = 0
58-
attachment.set_file_size local_file
59-
attachment.set_content_type local_file
60-
attachment.set_digest local_file
66+
attachment.extend(OpenProject::ChangedBySystem)
67+
attachment.change_by_system do
68+
attachment.downloads = 0
69+
attachment.set_file_size local_file
70+
attachment.set_content_type local_file
71+
attachment.set_digest local_file
72+
end
6173
end
6274

6375
def save_attachment(attachment)
64-
User.execute_as(attachment.author) do
65-
attachment.save! if attachment.changed?
76+
attachment.save! if attachment.changed?
77+
end
78+
79+
def validate_attachment(attachment)
80+
contract = create_contract attachment
81+
82+
unless contract.valid?
83+
errors = contract.errors.full_messages.join(", ")
84+
raise "Failed to validate attachment #{attachment.id}: #{errors}"
6685
end
6786
end
6887

88+
def create_contract(attachment)
89+
::Attachments::CreateContract.new(attachment, attachment.author)
90+
end
91+
6992
def journalize_container(attachment)
7093
journable = attachment.container
7194

@@ -93,4 +116,11 @@ def touch_journable(journable)
93116
timestamps = attributes.index_with { Time.now }
94117
journable.update_columns(timestamps) if timestamps.any?
95118
end
119+
120+
def attachment_created_event(attachment)
121+
OpenProject::Notifications.send(
122+
OpenProject::Events::ATTACHMENT_CREATED,
123+
attachment: attachment
124+
)
125+
end
96126
end

config/locales/crowdin/es.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ es:
541541
error_enterprise_only: "solo está disponible en OpenProject Enterprise Edition"
542542
error_unauthorized: "no se puede acceder."
543543
error_readonly: "se intentó escribir pero no se puede escribir."
544-
email: "is not a valid email address."
544+
email: "no es una dirección de correo válida."
545545
empty: "No puede estar vacío."
546546
even: "debe ser incluido."
547547
exclusion: "está reservado."

config/locales/crowdin/js-ar.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ ar:
289289
current_new_feature_html: >
290290
The release contains various new features and improvements: <br> <ul class="%{list_styling_class}"> <li>New button in header navigation to create projects, users and work packages.</li> <li>A new invite modal for users, groups and placeholder users allows to easily add or invite new users and assign them to work packages.</li> <li>GitHub integration into OpenProject.</li> <li>API v3 extensions for groups and more, i.e. create, read, update and delete groups and group members through the API.</li> <li>Multi-selection for project custom fields of type list.</li> <li>Creation of backup from the web interface.</li> </ul>
291291
bim:
292-
learn_about_link: https://www.openproject.org/openproject-11-4-release
292+
learn_about_link: https://www.openproject.org/blog/openproject-11-4-release
293293
current_new_feature_html: >
294294
The release contains various new features and improvements: <br> <ul class="%{list_styling_class}"> <li>Take a look at our <a href="https://github.com/opf/openproject-revit-add-in">Revit Add-in</a> which lets you work on BCF work packages directly in Revit.</li> <li>IFC properties got a dedicated pane. Copying GUIDs has never been easier.</li> <li>Reverse clipping plane direction in BCF viewpoint and become compliant with future BCF 3.0 (Now same direction as Solibri). <li>Fixed viewing IFC models on mobile.</li> <li>Fixed export of work package views with BCF snapshot column.</li> </ul>
295295
label_activate: "تفعيل"
@@ -761,7 +761,7 @@ ar:
761761
no_results:
762762
title: لا يوجد مجموعات عمل لعرضها.
763763
description: إما أنه لا يوجد ما تم إنشاؤه أو أن جميع مجموعات العمل قد تمت فلترتها.
764-
limited_results: Only %{count} work packages can be shown in manual sorting mode. Please reduce the results by filtering.
764+
limited_results: Only %{count} work packages can be shown in manual sorting mode. Please reduce the results by filtering, or switch to automatic sorting.
765765
property_groups:
766766
details: "تفاصيل"
767767
people: "الناس"

0 commit comments

Comments
 (0)