OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fixing last CI errors, mostly related to adjusted behaviour of the angular autocomplete input
Jonas Jabarie93e39e19c2e
diff --git a/app/views/members/_member_form.html.erb b/app/views/members/_member_form.html.erbindex 4831a713839..dec20dd9562 100644--- a/app/views/members/_member_form.html.erb+++ b/app/views/members/_member_form.html.erb@@ -59,7 +59,7 @@ See COPYRIGHT and LICENSE files for more details.<%= angular_component_tag 'opce-members-autocompleter',inputs: {- inputName: "member[user_ids][]",+ inputName: "member[user_ids]",inputBindValue: "id",url: autocomplete_for_member_project_members_path + '.json',appendTo: "body",diff --git a/modules/dashboards/spec/features/project_details_spec.rb b/modules/dashboards/spec/features/project_details_spec.rbindex 3957ba2c4cb..828c04e60c8 100644--- a/modules/dashboards/spec/features/project_details_spec.rb+++ b/modules/dashboards/spec/features/project_details_spec.rb@@ -26,12 +26,12 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-require_relative '../support/pages/dashboard'+require_relative "../support/pages/dashboard"-RSpec.describe 'Project details widget on dashboard', :js do- let(:system_version) { create(:version, sharing: 'system') }+RSpec.describe "Project details widget on dashboard", :js do+ let(:system_version) { create(:version, sharing: "system") }let!(:project) docreate(:project, members: { other_user => role })@@ -58,13 +58,13 @@ RSpec.describe 'Project details widget on dashboard', :js dolet(:editing_user) docreate(:user,member_with_permissions: { project => editing_permissions },- firstname: 'Cool',- lastname: 'Guy')+ firstname: "Cool",+ lastname: "Guy")endlet(:other_user) docreate(:user,- firstname: 'Other',- lastname: 'User')+ firstname: "Other",+ lastname: "User")endlet(:dashboard_page) do@@ -75,7 +75,7 @@ RSpec.describe 'Project details widget on dashboard', :js dodashboard_page.visit!dashboard_page.add_widget(1, 1, :within, "Project details")- dashboard_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')+ dashboard_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")endbefore do@@ -83,19 +83,19 @@ RSpec.describe 'Project details widget on dashboard', :js doadd_project_details_widgetend- context 'without editing permissions' do+ context "without editing permissions" dolet(:current_user) { read_only_user }- it 'displays the deprecated message' do+ it "displays the deprecated message" do# As the user lacks the manage_public_queries and save_queries permission, no other widget is present- details_widget = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')+ details_widget = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)")within(details_widget.area) doexpect(page).to have_content("Project details have now moved to a column on the right edge of this page.")expect(page).to have_content(<<~TEXT.strip- Starting with version 13.4, project attributes can be grouped \+ Starting with version 13.5, project attributes can be grouped \in sections and enabled and disabled at a project level.TEXT)@@ -109,19 +109,19 @@ RSpec.describe 'Project details widget on dashboard', :js doendend- context 'with editing permissions' do+ context "with editing permissions" dolet(:current_user) { editing_user }- it 'displays the deprecated message' do+ it "displays the deprecated message" do# As the user lacks the manage_public_queries and save_queries permission, no other widget is present- details_widget = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')+ details_widget = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)")within(details_widget.area) doexpect(page).to have_content("Project details have now moved to a column on the right edge of this page.")expect(page).to have_content(<<~TEXT.strip- Starting with version 13.4, project attributes can be grouped \+ Starting with version 13.5, project attributes can be grouped \in sections and enabled and disabled at a project level.TEXT)@@ -135,17 +135,17 @@ RSpec.describe 'Project details widget on dashboard', :js doendend- context 'when project has Activity module enabled' do+ context "when project has Activity module enabled" dolet(:current_user) { read_only_user }it 'has a "Project activity" entry in More menu linking to the project activity page' do- details_widget = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')+ details_widget = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)")- details_widget.expect_menu_item('Project details activity')+ details_widget.expect_menu_item("Project details activity")- details_widget.click_menu_item('Project details activity')+ details_widget.click_menu_item("Project details activity")expect(page).to have_current_path(project_activity_index_path(project), ignore_query: true)- expect(page).to have_checked_field(id: 'event_types_project_attributes')+ expect(page).to have_checked_field(id: "event_types_project_attributes")endendenddiff --git a/modules/reporting/lib/widget/filters/multi_choice.rb b/modules/reporting/lib/widget/filters/multi_choice.rbindex fab1ed00456..31a4080adbe 100644--- a/modules/reporting/lib/widget/filters/multi_choice.rb+++ b/modules/reporting/lib/widget/filters/multi_choice.rb@@ -29,19 +29,19 @@class Widget::Filters::MultiChoice < Widget::Filters::Basedef renderfilterName = filter_class.underscore_name- result = content_tag :div, id: "#{filterName}_arg_1", class: 'advanced-filters--filter-value' do+ result = content_tag :div, id: "#{filterName}_arg_1", class: "advanced-filters--filter-value" dochoices = filter_class.available_values.each_with_index.map do |(label, value), i|opts = {- type: 'radio',+ type: "radio",name: "values[#{filterName}][]",id: "#{filterName}_radio_option_#{i}",value:}- opts[:checked] = 'checked' if filter.values == [value].flatten+ opts[:checked] = "checked" if filter.values == [value].flattenradio_button = tag :input, optscontent_tag :label, radio_button + translate(label),for: "#{filterName}_radio_option_#{i}",- 'data-filter-name': filter_class.underscore_name,+ "data-filter-name": filter_class.underscore_name,class: "#{filterName}_radio_option filter_radio_option"endcontent_tag :div, choices.join.html_safe,diff --git a/modules/reporting/lib/widget/filters/multi_values.rb b/modules/reporting/lib/widget/filters/multi_values.rbindex 1d11f22d658..e4364e4016a 100644--- a/modules/reporting/lib/widget/filters/multi_values.rb+++ b/modules/reporting/lib/widget/filters/multi_values.rb@@ -28,37 +28,37 @@class Widget::Filters::MultiValues < Widget::Filters::Basedef render- write(content_tag(:div, id: "#{filter_class.underscore_name}_arg_1", class: 'advanced-filters--filter-value') do- select_options = { 'data-remote-url': url_for(action: 'available_values'),- 'data-initially-selected': JSON::dump(Array(filter.values).flatten),- style: 'vertical-align: top;', # FIXME: Do CSS+ write(content_tag(:div, id: "#{filter_class.underscore_name}_arg_1", class: "advanced-filters--filter-value") do+ select_options = { "data-remote-url": url_for(action: "available_values"),+ "data-initially-selected": JSON::dump(Array(filter.values).flatten),+ style: "vertical-align: top;", # FIXME: Do CSSname: "values[#{filter_class.underscore_name}][]",- 'data-loading': @options[:lazy] ? 'ajax' : '',+ "data-loading": @options[:lazy] ? "ajax" : "",id: "#{filter_class.underscore_name}_arg_1_val",- class: 'form--select filter-value',- 'data-filter-name': filter_class.underscore_name }- box_content = ''.html_safe+ class: "form--select filter-value",+ "data-filter-name": filter_class.underscore_name }+ box_content = "".html_safelabel = label_tag "#{filter_class.underscore_name}_arg_1_val",- h(filter_class.label) + ' ' + I18n.t(:label_filter_value),- class: 'hidden-for-sighted'+ h(filter_class.label) + " " + I18n.t(:label_filter_value),+ class: "hidden-for-sighted"box = content_tag :select, select_options, id: "#{filter_class.underscore_name}_select_1" dorender_widget Widget::Filters::Option, filter, to: box_content unless @options[:lazy]endplus = content_tag :a,- href: '#',- class: 'form-label filter_multi-select -transparent',- 'data-filter-name': filter_class.underscore_name,+ href: "#",+ class: "form-label filter_multi-select -transparent",+ "data-filter-name": filter_class.underscore_name,title: I18n.t(:description_multi_select) docontent_tag :span,- '',- class: 'icon-context icon-button icon-add icon4',+ "",+ class: "icon-context icon-button icon-add icon4",title: I18n.t(:label_enable_multi_select) do- content_tag :span, I18n.t(:label_enable_multi_select), class: 'hidden-for-sighted'+ content_tag :span, I18n.t(:label_enable_multi_select), class: "hidden-for-sighted"endend- content_tag(:span, class: 'inline-label') do+ content_tag(:span, class: "inline-label") dolabel + box + plusendend)diff --git a/modules/reporting/lib/widget/filters/project.rb b/modules/reporting/lib/widget/filters/project.rbindex 496e2e84cbd..6b827053a49 100644--- a/modules/reporting/lib/widget/filters/project.rb+++ b/modules/reporting/lib/widget/filters/project.rb@@ -30,22 +30,22 @@ class Widget::Filters::Project < Widget::Filters::Baseinclude AngularHelperdef render- write(content_tag(:div, id: "#{filter_class.underscore_name}_arg_1", class: 'advanced-filters--filter-value') do+ write(content_tag(:div, id: "#{filter_class.underscore_name}_arg_1", class: "advanced-filters--filter-value") dolabel = html_labelselected_values = map_filter_values- box = angular_component_tag 'opce-project-autocompleter',+ box = angular_component_tag "opce-project-autocompleter",inputs: {filters: [],- InputName: "values[#{filter_class.underscore_name}][]",+ InputName: "values[#{filter_class.underscore_name}]",multiple: true,model: selected_values.filter { |item| !item.nil? }},id: "#{filter_class.underscore_name}_select_1",- class: 'filter-value'+ class: "filter-value"- content_tag(:span, class: 'inline-label') do+ content_tag(:span, class: "inline-label") dolabel + boxendend)@@ -56,13 +56,13 @@ class Widget::Filters::Project < Widget::Filters::Basedef html_labellabel_tag "#{filter_class.underscore_name}_arg_1_val","#{h(filter_class.label)} #{I18n.t(:label_filter_value)}",- class: 'hidden-for-sighted'+ class: "hidden-for-sighted"enddef map_filter_values# In case the filter values are all written in a single string (e.g. ["12, 33"])if filter.values.length === 1 && filter.values[0].instance_of?(String)- filter.values = filter.values[0].split(',')+ filter.values = filter.values[0].split(",")endfilter.values.each.map do |id|diff --git a/spec/factories/custom_field_factory.rb b/spec/factories/custom_field_factory.rbindex 5fbb5761f92..1c4616222b0 100644--- a/spec/factories/custom_field_factory.rb+++ b/spec/factories/custom_field_factory.rb@@ -33,24 +33,24 @@ FactoryBot.define do# when using traits. They are not meant to be set externally._format_name do[- multi_value ? 'multi-' : nil,+ multi_value ? "multi-" : nil,field_format].compact.joinend_type_name { instance.class.name.underscore.humanize(capitalize: false) }endsequence(:name) do |n, _e|- [_format_name, _type_name, n.to_s].join(' ').capitalize+ [_format_name, _type_name, n.to_s].join(" ").capitalizeend- regexp { '' }+ regexp { "" }is_required { false }min_length { false }- default_value { '' }+ default_value { "" }max_length { false }editable { true }- possible_values { '' }+ possible_values { "" }visible { true }- field_format { 'bool' }+ field_format { "bool" }after(:create) do# As the request store keeps track of the created custom fields@@ -58,29 +58,29 @@ FactoryBot.define doendtrait :boolean do- _format_name { 'boolean' }- field_format { 'bool' }+ _format_name { "boolean" }+ field_format { "bool" }endtrait :string do- field_format { 'string' }+ field_format { "string" }endtrait :text do- field_format { 'text' }+ field_format { "text" }endtrait :integer do- _format_name { 'integer' }- field_format { 'int' }+ _format_name { "integer" }+ field_format { "int" }endtrait :float do- field_format { 'float' }+ field_format { "float" }endtrait :date do- field_format { 'date' }+ field_format { "date" }endtrait :list do@@ -88,9 +88,9 @@ FactoryBot.define dodefault_option { nil }default_options { nil }end- field_format { 'list' }+ field_format { "list" }multi_value { false }- possible_values { ['A', 'B', 'C', 'D', 'E', 'F', 'G'] }+ possible_values { ["A", "B", "C", "D", "E", "F", "G"] }# update custom options default value from the default_option transient# field for non-multiselect field@@ -140,24 +140,24 @@ FactoryBot.define doendtrait :version do- field_format { 'version' }+ field_format { "version" }endtrait :multi_version do- field_format { 'version' }+ field_format { "version" }multi_value { true }endtrait :user do- field_format { 'user' }+ field_format { "user" }endtrait :multi_user do- field_format { 'user' }+ field_format { "user" }multi_value { true }end- factory :project_custom_field, class: 'ProjectCustomField' do+ factory :project_custom_field, class: "ProjectCustomField" doproject_custom_field_sectiontransient do@@ -170,7 +170,9 @@ FactoryBot.define donext if projects.blank?projects.each do |project|- create(:project_custom_field_project_mapping, project:, project_custom_field: custom_field)+ unless project.project_custom_fields.include?(custom_field)+ create(:project_custom_field_project_mapping, project:, project_custom_field: custom_field)+ endendend@@ -185,12 +187,12 @@ FactoryBot.define dofactory :user_project_custom_field, traits: [:user]end- factory :user_custom_field, class: 'UserCustomField'+ factory :user_custom_field, class: "UserCustomField"- factory :group_custom_field, class: 'GroupCustomField'+ factory :group_custom_field, class: "GroupCustomField"- factory :wp_custom_field, class: 'WorkPackageCustomField' do- _type_name { 'WP custom field' }+ factory :wp_custom_field, class: "WorkPackageCustomField" do+ _type_name { "WP custom field" }is_filter { true }transient do@@ -214,16 +216,16 @@ FactoryBot.define dofactory :user_wp_custom_field, traits: [:user]end- factory :issue_custom_field, class: 'WorkPackageCustomField' do- _type_name { 'issue custom field' }+ factory :issue_custom_field, class: "WorkPackageCustomField" do+ _type_name { "issue custom field" }end- factory :time_entry_custom_field, class: 'TimeEntryCustomField' do- field_format { 'text' }+ factory :time_entry_custom_field, class: "TimeEntryCustomField" do+ field_format { "text" }end- factory :version_custom_field, class: 'VersionCustomField' do- field_format { 'text' }+ factory :version_custom_field, class: "VersionCustomField" do+ field_format { "text" }endendenddiff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rbindex 202b6d8b6c8..a30791f83de 100644--- a/spec/features/projects/edit_settings_spec.rb+++ b/spec/features/projects/edit_settings_spec.rb@@ -26,9 +26,9 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe 'Projects', 'editing settings', :js, :with_cuprite do+RSpec.describe "Projects", "editing settings", :js, :with_cuprite dolet(:name_field) { FormFields::InputFormField.new :name }let(:parent_field) { FormFields::SelectFormField.new :parent }let(:permissions) { %i(edit_project) }@@ -38,74 +38,74 @@ RSpec.describe 'Projects', 'editing settings', :js, :with_cuprite doendshared_let(:project) do- create(:project, name: 'Foo project', identifier: 'foo-project')+ create(:project, name: "Foo project", identifier: "foo-project")end- it 'hides the field whose functionality is presented otherwise' do+ it "hides the field whose functionality is presented otherwise" dovisit project_settings_general_path(project.id)- expect(page).to have_no_text :all, 'Active'- expect(page).to have_no_text :all, 'Identifier'+ expect(page).to have_no_text :all, "Active"+ expect(page).to have_no_text :all, "Identifier"end- describe 'identifier edit' do- it 'updates the project identifier' do+ describe "identifier edit" do+ it "updates the project identifier" dovisit projects_pathclick_on project.name- click_on 'Project settings'- click_on 'Change identifier'+ click_on "Project settings"+ click_on "Change identifier"expect(page).to have_content "Change the project's identifier".upcase- expect(page).to have_current_path '/projects/foo-project/identifier'+ expect(page).to have_current_path "/projects/foo-project/identifier"- fill_in 'project[identifier]', with: 'foo-bar'- click_on 'Update'+ fill_in "project[identifier]", with: "foo-bar"+ click_on "Update"- expect(page).to have_content 'Successful update.'+ expect(page).to have_content "Successful update."expect(page).to have_current_path %r{/projects/foo-bar/settings/general}- expect(Project.first.identifier).to eq 'foo-bar'+ expect(Project.first.identifier).to eq "foo-bar"end- it 'displays error messages on invalid input' do+ it "displays error messages on invalid input" dovisit project_identifier_path(project)- fill_in 'project[identifier]', with: 'FOOO'- click_on 'Update'+ fill_in "project[identifier]", with: "FOOO"+ click_on "Update"- expect(page).to have_content 'Identifier is invalid.'- expect(page).to have_current_path '/projects/foo-project/identifier'+ expect(page).to have_content "Identifier is invalid."+ expect(page).to have_current_path "/projects/foo-project/identifier"endend- context 'with optional and required custom fields' do+ context "with optional and required custom fields" dolet!(:optional_custom_field) do- create(:project_custom_field, name: 'Optional Foo',+ create(:project_custom_field, name: "Optional Foo",is_for_all: true,projects: [project])endlet!(:required_custom_field) do- create(:project_custom_field, name: 'Required Foo',+ create(:project_custom_field, name: "Required Foo",is_for_all: true,is_required: true,projects: [project])end- it 'shows optional and required custom fields for edit without a separation' do- project.custom_field_values.last.value = 'FOO'+ it "shows optional and required custom fields for edit without a separation" do+ project.custom_field_values.last.value = "FOO"project.save!visit project_settings_general_path(project.id)- expect(page).to have_text 'Optional Foo'- expect(page).to have_text 'Required Foo'+ expect(page).to have_text "Optional Foo"+ expect(page).to have_text "Required Foo"endend- context 'with a length restricted custom field' do+ context "with a length restricted custom field" dolet!(:required_custom_field) docreate(:string_project_custom_field,- name: 'Foo',+ name: "Foo",min_length: 1,max_length: 2,is_for_all: true,@@ -113,114 +113,114 @@ RSpec.describe 'Projects', 'editing settings', :js, :with_cuprite doendlet(:foo_field) { FormFields::InputFormField.new required_custom_field }- it 'shows the errors of that field when saving (Regression #33766)' do+ it "shows the errors of that field when saving (Regression #33766)" dovisit project_settings_general_path(project.id)- expect(page).to have_content 'Foo'+ expect(page).to have_content "Foo"# Enter something too long- foo_field.set_value '1234'+ foo_field.set_value "1234"# It should cut of that remaining value- foo_field.expect_value '12'+ foo_field.expect_value "12"- click_button 'Save'+ click_button "Save"- expect(page).to have_text 'Successful update.'+ expect(page).to have_text "Successful update."endend- context 'with a multi-select custom field' do- include_context 'ng-select-autocomplete helpers'+ context "with a multi-select custom field" do+ include_context "ng-select-autocomplete helpers"- let!(:list_custom_field) { create(:list_project_custom_field, name: 'List CF', multi_value: true, projects: [project]) }+ let!(:list_custom_field) { create(:list_project_custom_field, name: "List CF", multi_value: true, projects: [project]) }let(:form_field) { FormFields::SelectFormField.new list_custom_field }- it 'can select multiple values' do+ it "can select multiple values" dovisit project_settings_general_path(project.id)- form_field.select_option 'A', 'B'+ form_field.select_option "A", "B"- click_on 'Save'+ click_on "Save"- expect(page).to have_content 'Successful update.'+ expect(page).to have_content "Successful update."- form_field.expect_selected 'A', 'B'+ form_field.expect_selected "A", "B"cvs = project.reload.custom_value_for(list_custom_field)expect(cvs.count).to eq 2- expect(cvs.map(&:typed_value)).to contain_exactly 'A', 'B'+ expect(cvs.map(&:typed_value)).to contain_exactly "A", "B"endend- context 'with a date custom field' do- let!(:date_custom_field) { create(:date_project_custom_field, name: 'Date', projects: [project]) }+ context "with a date custom field" do+ let!(:date_custom_field) { create(:date_project_custom_field, name: "Date", projects: [project]) }let(:form_field) { FormFields::InputFormField.new date_custom_field }- it 'can save and remove the date (Regression #37459)' do+ it "can save and remove the date (Regression #37459)" dovisit project_settings_general_path(project.id)- form_field.set_value '2021-05-26'+ form_field.set_value "2021-05-26"form_field.send_keys :enter- click_on 'Save'+ click_on "Save"- expect(page).to have_content 'Successful update.'+ expect(page).to have_content "Successful update."- form_field.expect_value '2021-05-26'+ form_field.expect_value "2021-05-26"cv = project.reload.custom_value_for(date_custom_field)- expect(cv.typed_value).to eq '2021-05-26'.to_date+ expect(cv.typed_value).to eq "2021-05-26".to_dateendend- context 'with a user not allowed to see the parent project' do- include_context 'ng-select-autocomplete helpers'+ context "with a user not allowed to see the parent project" do+ include_context "ng-select-autocomplete helpers"let(:parent_project) { create(:project) }- let(:parent_field) { FormFields::SelectFormField.new 'parent' }+ let(:parent_field) { FormFields::SelectFormField.new "parent" }before doproject.update_attribute(:parent, parent_project)end- it 'can update the project without destroying the relation to the parent' do+ it "can update the project without destroying the relation to the parent" dovisit project_settings_general_path(project.id)- fill_in 'Name', with: 'New project name'+ fill_in "Name", with: "New project name"- parent_field.expect_selected I18n.t(:'api_v3.undisclosed.parent')+ parent_field.expect_selected I18n.t(:"api_v3.undisclosed.parent")- click_on 'Save'+ click_on "Save"- expect(page).to have_content 'Successful update.'+ expect(page).to have_content "Successful update."project.reloadexpect(project.name)- .to eql 'New project name'+ .to eql "New project name"expect(project.parent).to eql parent_projectendend- context 'with correct scoping of project custom fields' do+ context "with correct scoping of project custom fields" dolet!(:optional_custom_field_activated_in_project) do- create(:project_custom_field, name: 'Optional Foo',+ create(:project_custom_field, name: "Optional Foo",is_for_all: true,projects: [project])endlet!(:optional_custom_field_not_activated_in_project) do- create(:project_custom_field, name: 'Optional Bar',+ create(:project_custom_field, name: "Optional Bar",is_for_all: true)end- it 'shows only the custom fields that are activated in the project' do+ it "shows only the custom fields that are activated in the project" dovisit project_settings_general_path(project.id)- expect(page).to have_text 'Optional Foo'- expect(page).to have_no_text 'Optional Bar'+ expect(page).to have_text "Optional Foo"+ expect(page).to have_no_text "Optional Bar"endendend