Skip to content

Commit

Permalink
Merge branch 'release/14.6' into task/58114-146-documentation-replace…
Browse files Browse the repository at this point in the history
…-add-assignee-button-in-team-pleanner-with-+-assignee
  • Loading branch information
MayaBerd authored Oct 8, 2024
2 parents bf0a17e + ed73e01 commit 48639bb
Show file tree
Hide file tree
Showing 229 changed files with 2,312 additions and 1,212 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
pull-requests: write # to comment on the PR

jobs:
check-pr:
version-check:
if: contains(github.event.pull_request.labels.*.name, 'needs review')
runs-on: ubuntu-latest

Expand All @@ -22,22 +22,27 @@ jobs:

- name: Verify linked version matches core version
id: version-check
run: ./script/ci/version_check.sh "${{ github.event.pull_request.body }}"
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: ./script/ci/version_check.sh "$PR_BODY"

- name: Add comment if versions differ
if: steps.version-check.outputs.version_mismatch == 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: version-mismatch-comment
message: |
The provided work package version does not match the core version:
> [!CAUTION]
> The provided work package version does not match the core version
Details:
- Work package URL: ${{ steps.version-check.outputs.wp_url }}
- Work package version: ${{steps.version-check.outputs.wp_version}}
- Core version: ${{steps.version-check.outputs.core_version}}
Please make sure that:
- The work package version OR your pull request target branch is correct
- name: Version check passed
if: steps.version-check.outputs.version_mismatch != 'true'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,4 @@ end

gem "openproject-octicons", "~>19.18.0"
gem "openproject-octicons_helper", "~>19.18.0"
gem "openproject-primer_view_components", "~>0.47.0"
gem "openproject-primer_view_components", "~>0.47.1"
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ GEM
actionview
openproject-octicons (= 19.18.0)
railties
openproject-primer_view_components (0.47.0)
openproject-primer_view_components (0.47.1)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
openproject-octicons (>= 19.17.0)
Expand Down Expand Up @@ -1303,7 +1303,7 @@ DEPENDENCIES
openproject-octicons (~> 19.18.0)
openproject-octicons_helper (~> 19.18.0)
openproject-openid_connect!
openproject-primer_view_components (~> 0.47.0)
openproject-primer_view_components (~> 0.47.1)
openproject-recaptcha!
openproject-reporting!
openproject-storages!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ def more_menu_detach_project
def detach_from_project_url
url_helpers.custom_field_project_path(
custom_field_id: @table.params[:custom_field].id,
custom_fields_project: { project_id: project.id }
custom_fields_project: { project_id: project.id },
page: current_page
)
end

def project = model.first
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Admin
module CustomFields
module CustomFieldProjects
class TableComponent < Projects::TableComponent
include OpTurbo::Streamable
include ::Projects::Concerns::TableComponent::StreamablePaginationLinksConstraints

def columns
@columns ||= query.selects.reject { |select| select.is_a?(Queries::Selects::NotExistingSelect) }
Expand All @@ -39,23 +39,6 @@ def columns
def sortable?
false
end

# @override optional_pagination_options are passed to the pagination_options
# which are passed to #pagination_links_full in pagination_helper.rb
#
# In Turbo streamable components, we need to be able to specify the url_for(action:) so that links are
# generated in the context of the component index action, instead of any turbo stream actions performing
# partial updates on the page.
#
# params[:url_for_action] is passed to the pagination_options making it's way down to any pagination links
# that are generated via link_to which calls url_for which uses the params[:url_for_action] to specify
# the controller action that link_to should use.
#
def optional_pagination_options
return super unless params[:url_for_action]

super.merge(params: { action: params[:url_for_action] })
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#-- 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.
#++

module Projects
module Concerns
module TableComponent
module StreamablePaginationLinksConstraints
# @override optional_pagination_options are passed to the pagination_options
# which are passed to #pagination_links_full in pagination_helper.rb
#
# In Turbo streamable components, we need to be able to specify the url_for(action:) so that links are
# generated in the context of the component index action, instead of any turbo stream actions performing
# partial updates on the page.
#
# params[:url_for_action] is passed to the pagination_options making it's way down to any pagination links
# that are generated via link_to which calls url_for which uses the params[:url_for_action] to specify
# the controller action that link_to should use.
#
# data-turbo-action="advance" is added to the pagination links ensure links pushState to the browser
#
def optional_pagination_options
super.tap do |options|
options[:params] = { action: params[:url_for_action] } if params[:url_for_action]
options[:turbo_action] = "advance"
end
end
end
end
end
end
4 changes: 4 additions & 0 deletions app/components/projects/row_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,9 @@ def user_can_view_project?
def custom_field_column?(column)
column.is_a?(::Queries::Projects::Selects::CustomField)
end

def current_page
table.model.current_page.to_s
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class RowComponent < Admin::CustomFields::CustomFieldProjects::RowComponent
def detach_from_project_url
url_helpers.unlink_admin_settings_project_custom_field_path(
id: @table.params[:custom_field].id,
project_custom_field_project_mapping: { project_id: project.id }
project_custom_field_project_mapping: { project_id: project.id },
page: current_page
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ def create
create_service.on_success { render_project_list(url_for_action: :index) }

create_service.on_failure do
update_flash_message_via_turbo_stream(
message: join_flash_messages(create_service.errors),
full: true, dismiss_scheme: :hide, scheme: :danger
render_error_flash_message_via_turbo_stream(
message: join_flash_messages(create_service.errors)
)
end

Expand All @@ -82,9 +81,8 @@ def destroy
delete_service.on_success { render_project_list(url_for_action: :index) }

delete_service.on_failure do
update_flash_message_via_turbo_stream(
message: join_flash_messages(delete_service.errors.full_messages),
full: true, dismiss_scheme: :hide, scheme: :danger
render_error_flash_message_via_turbo_stream(
message: join_flash_messages(delete_service.errors.full_messages)
)
end

Expand All @@ -103,7 +101,7 @@ def render_project_list(url_for_action: action_name)
update_via_turbo_stream(
component: Admin::CustomFields::CustomFieldProjects::TableComponent.new(
query: available_custom_fields_projects_query,
params: { custom_field: @custom_field, url_for_action: }
params: params.merge({ custom_field: @custom_field, url_for_action: })
)
)
end
Expand Down Expand Up @@ -139,15 +137,6 @@ def find_custom_field_project_to_destroy
respond_with_project_not_found_turbo_streams
end

def update_project_list_via_turbo_stream(url_for_action: action_name)
update_via_turbo_stream(
component: Admin::CustomFields::CustomFieldProjects::TableComponent.new(
query: available_custom_fields_projects_query,
params: { custom_field: @custom_field, url_for_action: }
)
)
end

def available_custom_fields_projects_query
@available_custom_fields_projects_query = ProjectQuery.new(
name: "custom-fields-projects-#{@custom_field.id}"
Expand All @@ -166,9 +155,8 @@ def initialize_custom_field_project
end

def respond_with_project_not_found_turbo_streams
update_flash_message_via_turbo_stream message: t(:notice_project_not_found), full: true, dismiss_scheme: :hide,
scheme: :danger
update_project_list_via_turbo_stream
render_error_flash_message_via_turbo_stream message: t(:notice_project_not_found)
render_project_list(url_for_action: :index)

respond_with_turbo_streams
end
Expand Down
29 changes: 9 additions & 20 deletions app/controllers/admin/settings/project_custom_fields_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ def link
create_service.on_success { render_project_list(url_for_action: :project_mappings) }

create_service.on_failure do
update_flash_message_via_turbo_stream(
message: join_flash_messages(create_service.errors),
full: true, dismiss_scheme: :hide, scheme: :danger
render_error_flash_message_via_turbo_stream(
message: join_flash_messages(create_service.errors)
)
end

Expand All @@ -106,9 +105,8 @@ def unlink
delete_service.on_success { render_project_list(url_for_action: :project_mappings) }

delete_service.on_failure do
update_flash_message_via_turbo_stream(
message: join_flash_messages(delete_service.errors.full_messages),
full: true, dismiss_scheme: :hide, scheme: :danger
render_error_flash_message_via_turbo_stream(
message: join_flash_messages(delete_service.errors.full_messages)
)
end

Expand Down Expand Up @@ -158,7 +156,7 @@ def render_project_list(url_for_action: action_name)
update_via_turbo_stream(
component: Settings::ProjectCustomFields::ProjectCustomFieldMapping::TableComponent.new(
query: project_custom_field_mappings_query,
params: { custom_field: @custom_field, url_for_action: }
params: params.merge({ custom_field: @custom_field, url_for_action: })
)
)
end
Expand All @@ -184,15 +182,8 @@ def find_unlink_project_custom_field_mapping
project_id: permitted_params.project_custom_field_project_mapping[:project_id]
)
rescue ActiveRecord::RecordNotFound
update_flash_message_via_turbo_stream(
message: t(:notice_file_not_found), full: true, dismiss_scheme: :hide, scheme: :danger
)
replace_via_turbo_stream(
component: Settings::ProjectCustomFields::ProjectCustomFieldMapping::TableComponent.new(
query: project_custom_field_mappings_query,
params: { custom_field: @custom_field }
)
)
render_error_flash_message_via_turbo_stream(message: t(:notice_file_not_found))
render_project_list(url_for_action: :project_mappings)

respond_with_turbo_streams
end
Expand All @@ -213,10 +204,8 @@ def find_custom_field_projects_to_link
false
end
rescue ActiveRecord::RecordNotFound
update_flash_message_via_turbo_stream(
message: t(:notice_project_not_found), full: true, dismiss_scheme: :hide, scheme: :danger
)
render_project_list
render_error_flash_message_via_turbo_stream(message: t(:notice_project_not_found))
render_project_list(url_for_action: :project_mappings)

respond_with_turbo_streams
end
Expand Down
6 changes: 0 additions & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,6 @@ def labeled_check_box_tags(name, collection, options = {})
end.join.html_safe
end

def html_hours(text)
html_safe_gsub(text,
%r{(\d+)\.(\d+)},
'<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
end

def html_safe_gsub(string, *gsub_args, &)
html_safe = string.html_safe?
result = string.gsub(*gsub_args, &)
Expand Down
15 changes: 15 additions & 0 deletions app/helpers/pagination_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def previous_or_next_page(page, text, class_suffix)
def link(text, target, attributes)
new_attributes = attributes.dup
new_attributes["data-turbo-stream"] = true if turbo?
new_attributes["data-turbo-action"] = turbo_action if turbo_action.present?

super(text, target, new_attributes)
end
Expand All @@ -210,6 +211,20 @@ def allowed_params
@options[:allowed_params] # rubocop:disable Rails/HelperInstanceVariable
end

# Customize the Turbo visit action for pagination links. Can be set to "advance" or "replace".
# "advance" - push a new entry onto the history stack.
# "replace" - replace the current history entry.
# See: https://turbo.hotwired.dev/reference/attributes
#
# Example: Promoting a Frame Navigation to a Page Visit
# By default navigation within a turbo frame does not change the rest of the browser's state,
# but you can promote a frame navigation a "Visit" by setting the turbo-action attribute to "advance".
# See: https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit
#
def turbo_action
@options[:turbo_action] # rubocop:disable Rails/HelperInstanceVariable
end

def turbo?
@options[:turbo] # rubocop:disable Rails/HelperInstanceVariable
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Status < ApplicationRecord
uniqueness: { case_sensitive: false },
length: { maximum: 256 }

validates :default_done_ratio, inclusion: { in: 0..100, allow_nil: true }
validates :default_done_ratio, inclusion: { in: 0..100, allow_nil: false }

validate :default_status_must_not_be_readonly

Expand Down
2 changes: 1 addition & 1 deletion app/seeders/oauth_applications_seeder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_app
OAuth::Applications::CreateService
.new(user: User.system)
.call(
enabled: true,
enabled: false,
name: "OpenProject Mobile App",
redirect_uri: "openprojectapp://oauth-callback",
builtin: true,
Expand Down
1 change: 1 addition & 0 deletions app/views/custom_styles/_primer_color_mapping.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
--controlKnob-borderColor-checked: var(--control-checked-color) !important;
--button-primary-fgColor-rest: var(--button--primary-font-color) !important;
--button-primary-bgColor-rest: var(--button--primary-background-color) !important;
--button-primary-bgColor-active: var(--button--primary-background-active-color) !important;
--button-primary-bgColor-hover: var(--button--primary-background-hover-color) !important;
--button-primary-bgColor-disabled: var(--button--primary-background-disabled-color) !important;
--button-primary-borderColor-disabled: var(--button--primary-border-disabled-color) !important;
Expand Down
1 change: 0 additions & 1 deletion app/views/notifications/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<% content_for :content_body do %>
<%= angular_component_tag "opce-notification-center" %>
dd
<% end %>

<% content_for :content_body_right do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/statuses/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.

<section class="form--section">
<div class="form--field -required"><%= f.text_field "name", required: true, container_class: "-middle" %></div>
<div class="form--field"><%= f.number_field "default_done_ratio", min: 0, max: 100, container_class: "-xslim" %></div>
<div class="form--field -required"><%= f.number_field "default_done_ratio", required: true, min: 0, max: 100, container_class: "-xslim" %></div>
<div class="form--field"><%= f.check_box "is_closed" %></div>
<% unless @status.is_default? %>
<div class="form--field"><%= f.check_box "is_default" %></div>
Expand Down
Loading

0 comments on commit 48639bb

Please sign in to comment.