diff --git a/.dockerignore b/.dockerignore index a8ba0c44986d..9847bf73b04e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,6 +22,9 @@ browserslist !/docs/api/apiv3/tags !/docs/api/apiv3/components +# Allow factories in case we use lookbook +!/spec/factories + extra features help diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 176773af552c..e945cf1b8c7b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,9 @@ - +# Ticket + + + - + # What are you trying to accomplish? @@ -13,9 +16,6 @@ List any tradeoffs you made to take on or pay down tech debt. Describe any alternative approaches you considered and why you discarded them. --> -# Ticket - - # Merge checklist - [ ] Added/updated tests diff --git a/.github/workflows/i18n-tasks.yml b/.github/workflows/i18n-tasks.yml new file mode 100644 index 000000000000..fdc79ac23248 --- /dev/null +++ b/.github/workflows/i18n-tasks.yml @@ -0,0 +1,44 @@ +name: i18n-inconsistency-check + +on: + push: + branches: + - dev + - release/* + paths-ignore: + - 'docs/**' + - 'help/**' + pull_request: + types: [opened, reopened, synchronize] + paths-ignore: + - 'docs/**' + - 'help/**' + - 'packaging/**' + - '.pkgr.yml' + +permissions: + contents: read + +jobs: + i18n-tasks: + permissions: + contents: read + if: github.repository == 'opf/openproject' + name: I18n inconsistency check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + + - name: Setup i18n-tasks + run: | + gem install i18n-tasks + + - name: Run inconsistent translations check + run: | + i18n-tasks \ + check-consistent-interpolations \ + --config config/i18n-tasks-all-files.yml diff --git a/.rubocop.yml b/.rubocop.yml index addb52904d6b..821c3902e520 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -211,6 +211,15 @@ Rails/DynamicFindBy: Whitelist: - find_by_login +# Allow reorder to prevent find each cop triggering +Rails/FindEach: + AllowedMethods: + - order + - reorder + - limit + - select + - lock + # We have config.active_record.belongs_to_required_by_default = false , # which means, we do have to declare presence validators on belongs_to relations. Rails/RedundantPresenceValidationOnBelongsTo: diff --git a/Gemfile b/Gemfile index fd7e92c9d1d1..82afc46d7b9c 100644 --- a/Gemfile +++ b/Gemfile @@ -212,6 +212,7 @@ gem "validate_url" gem "dry-auto_inject" gem "dry-container" gem "dry-monads" +gem "dry-validation" # ActiveRecord extension which adds typecasting to store accessors gem "store_attribute", "~> 1.0" diff --git a/Gemfile.lock b/Gemfile.lock index 19afc7293201..a6b1b118f404 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -342,16 +342,16 @@ GEM activerecord (>= 4.0.0, < 7.2) awrence (1.2.1) aws-eventstream (1.3.0) - aws-partitions (1.963.0) - aws-sdk-core (3.201.4) + aws-partitions (1.964.0) + aws-sdk-core (3.201.5) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) aws-sdk-kms (1.88.0) aws-sdk-core (~> 3, >= 3.201.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.157.0) + aws-sdk-s3 (1.158.0) aws-sdk-core (~> 3, >= 3.201.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) @@ -470,12 +470,16 @@ GEM dry-auto_inject (1.0.1) dry-core (~> 1.0) zeitwerk (~> 2.6) + dry-configurable (1.2.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) dry-container (0.11.0) concurrent-ruby (~> 1.0) dry-core (1.0.1) concurrent-ruby (~> 1.0) zeitwerk (~> 2.6) dry-inflector (1.1.0) + dry-initializer (3.1.1) dry-logic (1.5.0) concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) @@ -484,6 +488,14 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) + dry-schema (1.13.4) + concurrent-ruby (~> 1.0) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.0, < 2) + dry-initializer (~> 3.0) + dry-logic (>= 1.4, < 2) + dry-types (>= 1.7, < 2) + zeitwerk (~> 2.6) dry-types (1.7.2) bigdecimal (~> 3.0) concurrent-ruby (~> 1.0) @@ -491,6 +503,12 @@ GEM dry-inflector (~> 1.0) dry-logic (~> 1.4) zeitwerk (~> 2.6) + dry-validation (1.10.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + dry-initializer (~> 3.0) + dry-schema (>= 1.12, < 2) + zeitwerk (~> 2.6) dumb_delegator (1.0.0) em-http-request (1.1.7) addressable (>= 2.3.4) @@ -561,7 +579,7 @@ GEM friendly_id (5.5.1) activerecord (>= 4.0.0) front_matter_parser (1.0.1) - fugit (1.11.0) + fugit (1.11.1) et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) fuubar (2.5.1) @@ -680,7 +698,7 @@ GEM launchy (3.0.1) addressable (~> 2.8) childprocess (~> 5.0) - lefthook (1.7.12) + lefthook (1.7.14) letter_opener (1.10.0) launchy (>= 2.2, < 4) letter_opener_web (3.0.0) @@ -722,7 +740,7 @@ GEM net-pop net-smtp marcel (1.0.4) - markly (0.10.0) + markly (0.12.1) matrix (0.4.2) messagebird-rest (1.4.2) meta-tags (2.22.0) @@ -734,7 +752,7 @@ GEM mini_magick (5.0.1) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.25.0) + minitest (5.25.1) msgpack (1.7.2) multi_json (1.15.0) mustermann (3.0.2) @@ -972,7 +990,7 @@ GEM rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.3) + rspec-rails (6.1.4) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -1032,7 +1050,7 @@ GEM rubyzip (2.3.2) safety_net_attestation (0.4.0) jwt (~> 2.0) - sanitize (6.1.2) + sanitize (6.1.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) secure_headers (6.5.0) @@ -1046,7 +1064,7 @@ GEM websocket (~> 1.0) semantic (1.6.1) shoulda-context (2.0.0) - shoulda-matchers (6.3.1) + shoulda-matchers (6.4.0) activesupport (>= 5.2.0) signet (0.19.0) addressable (~> 2.8) @@ -1123,7 +1141,8 @@ GEM validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix - vcr (6.2.0) + vcr (6.3.0) + base64 view_component (3.13.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) @@ -1216,6 +1235,7 @@ DEPENDENCIES dry-auto_inject dry-container dry-monads + dry-validation email_validator (~> 2.2.3) equivalent-xml (~> 0.6) erb_lint diff --git a/app/components/_index.sass b/app/components/_index.sass index 2f1db2aa1ed7..bf0cfde03645 100644 --- a/app/components/_index.sass +++ b/app/components/_index.sass @@ -7,5 +7,4 @@ @import "open_project/common/submenu_component" @import "filter/filters_component" @import "projects/row_component" -@import "settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component" @import "op_primer/border_box_table_component" diff --git a/app/components/admin/attachments_settings_header_component.html.erb b/app/components/admin/attachments_settings_header_component.html.erb index a4d5767fed9a..a264231f9aaa 100644 --- a/app/components/admin/attachments_settings_header_component.html.erb +++ b/app/components/admin/attachments_settings_header_component.html.erb @@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details. <% helpers.html_title t(:label_administration), @title %> -<%= render(Primer::OpenProject::PageHeader.new(border_bottom: 0)) do |header| +<%= render(Primer::OpenProject::PageHeader.new) do |header| header.with_title { t(:"attributes.attachments") } header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") }, { href: admin_settings_storages_path, text: t("project_module_storages") }, diff --git a/app/components/filter/filter_component.html.erb b/app/components/filter/filter_component.html.erb index 0d4759bebca9..43901b555bc9 100644 --- a/app/components/filter/filter_component.html.erb +++ b/app/components/filter/filter_component.html.erb @@ -113,15 +113,5 @@ <%= submit_tag t('button_apply'), class: 'button -small -primary', name: nil %> - <% unless EnterpriseToken.allows_to?(:custom_fields_in_projects_list)%> - <%= - helpers.angular_component_tag 'op-enterprise-banner', - inputs: { - collapsible: true, - textMessage: t('ee.upsale.project_filters.description_html'), - moreInfoLink: OpenProject::Static::Links.links[:enterprise_docs][:custom_field_projects][:href], - } - %> - <% end %> <% end %> diff --git a/app/components/individual_principal_base_filter_component.rb b/app/components/individual_principal_base_filter_component.rb index c8dc7d32d949..7e1291b6cfe9 100644 --- a/app/components/individual_principal_base_filter_component.rb +++ b/app/components/individual_principal_base_filter_component.rb @@ -8,7 +8,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/components/my/access_token/access_token_created_dialog_component.html.erb b/app/components/my/access_token/access_token_created_dialog_component.html.erb index 366a3b613888..bdc7c01fa5d0 100644 --- a/app/components/my/access_token/access_token_created_dialog_component.html.erb +++ b/app/components/my/access_token/access_token_created_dialog_component.html.erb @@ -1,6 +1,6 @@ <%#-- copyright OpenProject is an open source project management software. -Copyright (C) 2012-2024 the OpenProject GmbH +Copyright (C) the OpenProject GmbH This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. diff --git a/app/components/my/access_token/access_token_created_dialog_component.rb b/app/components/my/access_token/access_token_created_dialog_component.rb index b9c4924c79ae..4dce63aade45 100644 --- a/app/components/my/access_token/access_token_created_dialog_component.rb +++ b/app/components/my/access_token/access_token_created_dialog_component.rb @@ -1,6 +1,6 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2024 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/components/my/access_token/api/row_component.rb b/app/components/my/access_token/api/row_component.rb index 6e89dd97804d..70641421e9c6 100644 --- a/app/components/my/access_token/api/row_component.rb +++ b/app/components/my/access_token/api/row_component.rb @@ -2,7 +2,7 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2023 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/components/my/access_token/api/table_component.rb b/app/components/my/access_token/api/table_component.rb index 69d4d9fe5b77..dc0cd690e538 100644 --- a/app/components/my/access_token/api/table_component.rb +++ b/app/components/my/access_token/api/table_component.rb @@ -2,7 +2,7 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2023 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/components/my/access_token/api_tokens_section_component.html.erb b/app/components/my/access_token/api_tokens_section_component.html.erb index 0e89fa591810..cd6206d5638d 100644 --- a/app/components/my/access_token/api_tokens_section_component.html.erb +++ b/app/components/my/access_token/api_tokens_section_component.html.erb @@ -1,6 +1,6 @@ <%#-- copyright OpenProject is an open source project management software. -Copyright (C) 2012-2024 the OpenProject GmbH +Copyright (C) the OpenProject GmbH This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. diff --git a/app/components/my/access_token/api_tokens_section_component.rb b/app/components/my/access_token/api_tokens_section_component.rb index b5faee9bd59b..e6aa64c28352 100644 --- a/app/components/my/access_token/api_tokens_section_component.rb +++ b/app/components/my/access_token/api_tokens_section_component.rb @@ -1,6 +1,6 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2024 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/components/placeholder_users/placeholder_user_filter_component.rb b/app/components/placeholder_users/placeholder_user_filter_component.rb index 5afa134f538c..7188d1b20d83 100644 --- a/app/components/placeholder_users/placeholder_user_filter_component.rb +++ b/app/components/placeholder_users/placeholder_user_filter_component.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/components/placeholder_users/row_component.rb b/app/components/placeholder_users/row_component.rb index 29556731ffa0..a3521b287f53 100644 --- a/app/components/placeholder_users/row_component.rb +++ b/app/components/placeholder_users/row_component.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/components/placeholder_users/table_component.rb b/app/components/placeholder_users/table_component.rb index 450a7f50e3f1..d43d368a3c3e 100644 --- a/app/components/placeholder_users/table_component.rb +++ b/app/components/placeholder_users/table_component.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/components/projects/index_page_header_component.rb b/app/components/projects/index_page_header_component.rb index ee0bdbe3f0d5..eb8aefb86aed 100644 --- a/app/components/projects/index_page_header_component.rb +++ b/app/components/projects/index_page_header_component.rb @@ -65,9 +65,8 @@ def gantt_portfolio_project_ids @gantt_portfolio_project_ids ||= @query .results .where(active: true) - .select(:id) - .uniq .pluck(:id) + .uniq end def page_title diff --git a/app/components/projects/projects_filters_component.rb b/app/components/projects/projects_filters_component.rb index 058bb1cd7ad2..998369b943f8 100644 --- a/app/components/projects/projects_filters_component.rb +++ b/app/components/projects/projects_filters_component.rb @@ -41,20 +41,20 @@ def allowed_filters def allowed_filter?(filter) allowlist = [ + Queries::Filters::Shared::CustomFields::Base, Queries::Projects::Filters::ActiveFilter, - Queries::Projects::Filters::TemplatedFilter, - Queries::Projects::Filters::PublicFilter, - Queries::Projects::Filters::ProjectStatusFilter, - Queries::Projects::Filters::MemberOfFilter, Queries::Projects::Filters::CreatedAtFilter, + Queries::Projects::Filters::FavoredFilter, + Queries::Projects::Filters::IdFilter, Queries::Projects::Filters::LatestActivityAtFilter, + Queries::Projects::Filters::MemberOfFilter, Queries::Projects::Filters::NameAndIdentifierFilter, - Queries::Projects::Filters::TypeFilter, - Queries::Projects::Filters::FavoredFilter, - Queries::Projects::Filters::IdFilter + Queries::Projects::Filters::ProjectStatusFilter, + Queries::Projects::Filters::PublicFilter, + Queries::Projects::Filters::TemplatedFilter, + Queries::Projects::Filters::TypeFilter ] - allowlist << Queries::Filters::Shared::CustomFields::Base if EnterpriseToken.allows_to?(:custom_fields_in_projects_list) - allowlist.detect { |clazz| filter.is_a? clazz } + allowlist.any? { |clazz| filter.is_a? clazz } end end diff --git a/app/components/projects/table_component.html.erb b/app/components/projects/table_component.html.erb index 75c710351551..cb6fc2afc953 100644 --- a/app/components/projects/table_component.html.erb +++ b/app/components/projects/table_component.html.erb @@ -31,12 +31,12 @@ See COPYRIGHT and LICENSE files for more details.
tag with a sort link for the named column diff --git a/app/models/anonymous_user.rb b/app/models/anonymous_user.rb index f6d73f1f30cf..27e4514d6563 100644 --- a/app/models/anonymous_user.rb +++ b/app/models/anonymous_user.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/models/auth_provider.rb b/app/models/auth_provider.rb new file mode 100644 index 000000000000..69d724c0faed --- /dev/null +++ b/app/models/auth_provider.rb @@ -0,0 +1,47 @@ +#-- copyright +# OpenProject is an open source project management software. +# Copyright (C) the OpenProject GmbH +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# See COPYRIGHT and LICENSE files for more details. +#++ + +class AuthProvider < ApplicationRecord + belongs_to :creator, class_name: "User" + + validates :display_name, presence: true + validates :display_name, uniqueness: true + + def self.slug_fragment + raise NotImplementedError + end + + def auth_url + root_url = OpenProject::StaticRouting::StaticUrlHelpers.new.root_url + URI.join(root_url, "auth/#{slug}/").to_s + end + + def callback_url + URI.join(auth_url, "callback").to_s + end +end diff --git a/app/models/placeholder_user.rb b/app/models/placeholder_user.rb index edb42eec151f..61b3a826cbc8 100644 --- a/app/models/placeholder_user.rb +++ b/app/models/placeholder_user.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/models/queries/notifications.rb b/app/models/queries/notifications.rb index ddb7beb0a338..538d3987194c 100644 --- a/app/models/queries/notifications.rb +++ b/app/models/queries/notifications.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/models/queries/notifications/notification_query.rb b/app/models/queries/notifications/notification_query.rb index ca941033bcf5..2bb91ec02b68 100644 --- a/app/models/queries/notifications/notification_query.rb +++ b/app/models/queries/notifications/notification_query.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/models/queries/placeholder_users.rb b/app/models/queries/placeholder_users.rb index a98c53f8eea7..c2dabcf62664 100644 --- a/app/models/queries/placeholder_users.rb +++ b/app/models/queries/placeholder_users.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/models/queries/placeholder_users/placeholder_user_query.rb b/app/models/queries/placeholder_users/placeholder_user_query.rb index ae89cb42944c..ee592f7b7d9f 100644 --- a/app/models/queries/placeholder_users/placeholder_user_query.rb +++ b/app/models/queries/placeholder_users/placeholder_user_query.rb @@ -6,7 +6,7 @@ # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or diff --git a/app/models/queries/projects/orders/project_status_order.rb b/app/models/queries/projects/orders/project_status_order.rb index acabb614fcb5..7922a19f3800 100644 --- a/app/models/queries/projects/orders/project_status_order.rb +++ b/app/models/queries/projects/orders/project_status_order.rb @@ -37,7 +37,7 @@ def self.key def order(scope) with_raise_on_invalid do - scope.order(Arel.sql("status_code").send(direction)) + scope.order(status_code: direction) end end end diff --git a/app/models/queries/projects/selects/custom_field.rb b/app/models/queries/projects/selects/custom_field.rb index 97b855e319fa..b1b19f29ee28 100644 --- a/app/models/queries/projects/selects/custom_field.rb +++ b/app/models/queries/projects/selects/custom_field.rb @@ -33,10 +33,6 @@ def self.key /cf_(\d+)/ end - def self.available? - EnterpriseToken.allows_to?(:custom_fields_in_projects_list) - end - def self.all_available return [] unless available? diff --git a/app/models/work_packages/scopes/include_spent_time.rb b/app/models/work_packages/scopes/include_spent_time.rb index 4aa24c1183c7..ac0cfe3ced1d 100644 --- a/app/models/work_packages/scopes/include_spent_time.rb +++ b/app/models/work_packages/scopes/include_spent_time.rb @@ -31,12 +31,11 @@ module WorkPackages::Scopes::IncludeSpentTime class_methods do def include_spent_time(user, work_package = nil) - query = join_time_entries(user) - scope = left_join_self_and_descendants(user, work_package) - .joins(query.join_sources) + .with(visible_time_entries_cte.name => allowed_to_view_time_entries(user)) + .joins(join_visible_time_entries.join_sources) .group(:id) - .select("SUM(time_entries.hours) AS hours") + .select("SUM(#{visible_time_entries_cte.name}.hours) AS hours") if work_package scope.where(id: work_package.id) @@ -47,18 +46,14 @@ def include_spent_time(user, work_package = nil) protected - def join_time_entries(user) - join_condition = time_entries_table[:work_package_id] - .eq(wp_descendants[:id]) - .and(allowed_to_view_time_entries(user)) - + def join_visible_time_entries wp_table - .outer_join(time_entries_table) - .on(join_condition) + .outer_join(visible_time_entries_cte) + .on(visible_time_entries_cte[:work_package_id].eq(wp_descendants[:id])) end def allowed_to_view_time_entries(user) - time_entries_table[:id].in(TimeEntry.not_ongoing.visible(user).select(:id).arel) + TimeEntry.not_ongoing.visible(user).select(:id, :work_package_id, :hours).arel end def wp_table @@ -71,8 +66,8 @@ def wp_descendants @wp_descendants ||= wp_table.alias("descendants") end - def time_entries_table - @time_entries_table ||= TimeEntry.arel_table + def visible_time_entries_cte + @visible_time_entries_cte ||= Arel::Table.new("visible_time_entries") end end end diff --git a/app/services/authorization/enterprise_service.rb b/app/services/authorization/enterprise_service.rb index 5dacadd9c960..f07c857f0dae 100644 --- a/app/services/authorization/enterprise_service.rb +++ b/app/services/authorization/enterprise_service.rb @@ -29,29 +29,28 @@ class Authorization::EnterpriseService attr_accessor :token - GUARDED_ACTIONS = %i( + GUARDED_ACTIONS = %i[ baseline_comparison board_view conditional_highlighting custom_actions - custom_fields_in_projects_list date_alerts define_custom_style edit_attribute_groups + gantt_pdf_export grid_widget_wp_graph ldap_groups + one_drive_sharepoint_file_storage openid_providers placeholder_users + project_list_sharing readonly_work_packages team_planner_view two_factor_authentication + virus_scanning work_package_query_relation_columns work_package_sharing - one_drive_sharepoint_file_storage - virus_scanning - gantt_pdf_export - project_list_sharing - ).freeze + ].freeze def initialize(token) self.token = token diff --git a/app/services/custom_fields/create_service.rb b/app/services/custom_fields/create_service.rb index 3009ecbb377f..4d08c8aaba4a 100644 --- a/app/services/custom_fields/create_service.rb +++ b/app/services/custom_fields/create_service.rb @@ -54,7 +54,7 @@ def instance(params) def after_perform(call) cf = call.result - if cf.is_a?(ProjectCustomField) && EnterpriseToken.allows_to?(:custom_fields_in_projects_list) + if cf.is_a?(ProjectCustomField) add_cf_to_visible_columns(cf) end diff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb index 9c637bc96f26..0138952612d1 100644 --- a/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb +++ b/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb @@ -1,6 +1,6 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2024 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_status_based.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_status_based.rb index 5fdc67429e48..b38db2a6744a 100644 --- a/app/services/work_packages/set_attributes_service/derive_progress_values_status_based.rb +++ b/app/services/work_packages/set_attributes_service/derive_progress_values_status_based.rb @@ -1,6 +1,6 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2024 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb index 155e0796c984..c599d8456876 100644 --- a/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb +++ b/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb @@ -1,6 +1,6 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2024 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb b/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb index a1766f16c601..0248a413bf8f 100644 --- a/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb +++ b/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb @@ -1,6 +1,6 @@ #-- copyright # OpenProject is an open source project management software. -# Copyright (C) 2012-2024 the OpenProject GmbH +# Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. diff --git a/app/views/admin/backups/show.html.erb b/app/views/admin/backups/show.html.erb index 4c9d15683957..1b6f6fa64d16 100644 --- a/app/views/admin/backups/show.html.erb +++ b/app/views/admin/backups/show.html.erb @@ -90,7 +90,7 @@ See COPYRIGHT and LICENSE files for more details. <% end %> <% if @backup_token.present? %> -<%= tag :backup, data: { +<%= angular_component_tag "opce-backup", data: { 'job-status-id': @job_status_id, 'last-backup-date': @last_backup_date, 'last-backup-attachment-id': @last_backup_attachment_id, diff --git a/app/views/admin/settings/projects_settings/show.html.erb b/app/views/admin/settings/projects_settings/show.html.erb index c7f40de398af..f8ee4cf5648e 100644 --- a/app/views/admin/settings/projects_settings/show.html.erb +++ b/app/views/admin/settings/projects_settings/show.html.erb @@ -39,20 +39,6 @@ See COPYRIGHT and LICENSE files for more details. <%= styled_form_tag(admin_settings_projects_path, method: :patch) do %> |
---|