Skip to content

Commit 47813ce

Browse files
committed
Release OpenProject 17.0.5
2 parents 8009685 + c7405cd commit 47813ce

File tree

70 files changed

+2077
-239
lines changed

Some content is hidden

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

70 files changed

+2077
-239
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ on:
3232
permissions:
3333
contents: read # to fetch code (actions/checkout)
3434

35-
env:
36-
REGISTRY_IMAGE: openproject/openproject
37-
3835
jobs:
3936
setup:
4037
runs-on: ubuntu-latest
@@ -55,7 +52,7 @@ jobs:
5552
if [ "${{ inputs.use_test_registry }}" = "true" ]; then
5653
echo "registry_image=openproject/openproject-test" >> "$GITHUB_OUTPUT"
5754
else
58-
echo "registry_image=${{ env.REGISTRY_IMAGE }}" >> "$GITHUB_OUTPUT"
55+
echo "registry_image=${{ vars.REGISTRY_IMAGE }}" >> "$GITHUB_OUTPUT"
5956
fi
6057
- name: Verify outputs
6158
run: |
@@ -116,7 +113,7 @@ jobs:
116113
docker_tags: ${{ steps.extract_version.outputs.docker_tags }}
117114
registry_image: ${{ steps.extract_version.outputs.registry_image }}
118115
build:
119-
if: github.repository == 'opf/openproject'
116+
if: github.repository_owner == 'opf'
120117
needs:
121118
- setup
122119
runs-on:

app/controllers/users_controller.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,15 @@ def change_status # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
207207
end
208208

209209
def resend_invitation # rubocop:disable Metrics/AbcSize
210+
if @user.admin? && !current_user.admin?
211+
# non-admin users are not allowed to change admin status
212+
flash[:error] = I18n.t("user.error_admin_change_on_non_admin")
213+
redirect_to helpers.allowed_management_user_profile_path(@user)
214+
return
215+
end
216+
210217
status = Principal.statuses[:invited]
211-
@user.update status: status if @user.status != status
218+
@user.update!(status: status) if @user.status != status
212219

213220
token = UserInvitation.reinvite_user @user.id
214221

app/controllers/work_packages/activities_tab_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def respond_with_error(error_message)
222222
format.turbo_stream do
223223
@turbo_status = :not_found
224224
render_error_flash_message_via_turbo_stream(message: error_message)
225+
render turbo_stream: turbo_streams, status: :not_found
225226
end
226227
end
227228
end
@@ -239,7 +240,9 @@ def find_project
239240
end
240241

241242
def find_journal
242-
@journal = Journal
243+
@journal = @work_package
244+
.journals
245+
.internal_visible
243246
.with_sequence_version
244247
.find(params[:id])
245248
rescue ActiveRecord::RecordNotFound

app/models/attribute_help_text/work_package.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def type_caption
5353

5454
def self.visible_condition(user)
5555
visible_cf_names = WorkPackageCustomField
56-
.manageable_by_user(user)
56+
.visible(user)
5757
.pluck(:id)
5858
.map { |id| "custom_field_#{id}" }
5959

app/models/custom_field.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ class CustomField < ApplicationRecord
5353

5454
has_many :calculated_value_errors, dependent: :delete_all, inverse_of: "custom_field"
5555

56+
include Scopes::Scoped
57+
5658
scope :hierarchy_root_and_children, -> { includes(hierarchy_root: { children: :children }) }
5759
scope :required, -> { where(is_required: true).where.not(field_format: "calculated_value") }
5860

5961
scope :field_format_calculated_value, -> { where(field_format: "calculated_value") }
6062

63+
scopes :visible
64+
6165
acts_as_list scope: [:type]
6266

6367
validates :field_format, presence: true
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# frozen_string_literal: true
2+
3+
# -- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
# ++
30+
31+
module CustomFields::Scopes
32+
module Visible
33+
extend ActiveSupport::Concern
34+
35+
class_methods do
36+
def visible(user = User.current)
37+
known_subclasses
38+
.inject(none) do |scope, klass|
39+
scope.or(where(type: klass.name).and(klass.visible(user)))
40+
end
41+
end
42+
43+
def known_subclasses
44+
# In dev/test without eager loading, subclasses might not be loaded.
45+
if Rails.env.local?
46+
CustomField
47+
.group(:type)
48+
.pluck(:type)
49+
.map(&:safe_constantize)
50+
end
51+
52+
CustomField.subclasses
53+
end
54+
end
55+
end
56+
end

app/models/group_custom_field.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#++
3030

3131
class GroupCustomField < CustomField
32+
scopes :visible
33+
3234
def type_name
3335
:label_group_plural
3436
end
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# frozen_string_literal: true
2+
3+
# -- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
# ++
30+
31+
module GroupCustomFields::Scopes
32+
module Visible
33+
extend ActiveSupport::Concern
34+
35+
class_methods do
36+
def visible(user = User.current)
37+
if user.admin?
38+
all
39+
else
40+
where(admin_only: false)
41+
end
42+
end
43+
end
44+
end
45+
end

app/models/project_custom_field.rb

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,15 @@ class ProjectCustomField < CustomField
4646
has_one :role, through: :custom_fields_role
4747
accepts_nested_attributes_for :custom_fields_role, allow_destroy: true
4848

49+
scopes :visible
50+
4951
scope :user_field_with_assigned_role, -> do
5052
joins(:custom_fields_role)
5153
.where.not(custom_fields_roles: { role_id: nil })
5254
.where(field_format: "user")
5355
end
5456

5557
class << self
56-
def visible(user = User.current, project: nil)
57-
if user.admin?
58-
all
59-
elsif user.allowed_in_any_project?(:select_project_custom_fields) || user.allowed_globally?(:add_project)
60-
where(admin_only: false)
61-
else
62-
where(admin_only: false).where(mappings_with_view_project_attributes_permission(user, project).exists)
63-
end
64-
end
65-
66-
def toggleable_ids_in_project_settings(project, user, custom_field_section_id)
67-
toggleable_ids(
68-
project:,
69-
user:,
70-
custom_field_section_id:,
71-
options: { is_for_all: false }
72-
).first
73-
end
74-
75-
def toggleable_ids_in_creation_wizard_settings(project, custom_field_section_id)
76-
toggleable_ids(
77-
project:,
78-
custom_field_section_id:,
79-
options: { is_required: false },
80-
invert_options: { is_required: true }
81-
)
82-
end
83-
8458
private
8559

8660
# Returns an array with:
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# frozen_string_literal: true
2+
3+
# -- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
# ++
30+
31+
module ProjectCustomFields::Scopes
32+
module Visible
33+
extend ActiveSupport::Concern
34+
35+
class_methods do
36+
def visible(user = User.current, project: nil)
37+
if user.admin?
38+
all
39+
elsif user.allowed_in_any_project?(:select_project_custom_fields) || user.allowed_globally?(:add_project)
40+
where(admin_only: false)
41+
else
42+
where(admin_only: false).where(mappings_with_view_project_attributes_permission(user, project).exists)
43+
end
44+
end
45+
end
46+
end
47+
end

0 commit comments

Comments
 (0)