Skip to content

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

Fix setting the initial hidden value for list autocompleters.

Dombi Attila6ecef96fd501
diff --git a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts
index 0d15f10a7a9..9e764ce1f9c 100644
--- a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts
+++ b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts
@@ -370,7 +370,7 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet
}
if (Array.isArray(this.model)) {
- return this.model.map((el) => el[this.inputBindValue as 'id'] as string);
+ return this.model.map((el) => (_.isObject(el) ? el[this.inputBindValue as 'id'] : el) as string);
}
return this.model[this.inputBindValue as 'id'] as string;
diff --git a/spec/features/projects/persisted_lists_spec.rb b/spec/features/projects/persisted_lists_spec.rb
index 2f72c0d4f72..e3283e25e08 100644
--- a/spec/features/projects/persisted_lists_spec.rb
+++ b/spec/features/projects/persisted_lists_spec.rb
@@ -41,6 +41,7 @@ RSpec.describe "Persisted lists on projects index page",
shared_let(:custom_field) { create(:text_project_custom_field) }
shared_let(:invisible_custom_field) { create(:project_custom_field, admin_only: true) }
+ shared_let(:list_custom_field) { create(:list_project_custom_field) }
shared_let(:project) do
create(:project,
@@ -54,7 +55,8 @@ RSpec.describe "Persisted lists on projects index page",
public: true)
project.custom_field_values = {
invisible_custom_field.id => "Secret CF",
- custom_field.id => "Visible CF"
+ custom_field.id => "Visible CF",
+ list_custom_field.id => list_custom_field.possible_values.first.id
}
project.save
project
@@ -559,6 +561,23 @@ RSpec.describe "Persisted lists on projects index page",
projects_page.visit!
projects_page.set_sidebar_filter(my_projects_list.name)
projects_page.expect_filter_set("project_status_code", value: "On track")
+
+ projects_page.open_filters
+ projects_page.set_filter(list_custom_field.column_name,
+ list_custom_field.name,
+ "is (OR)",
+ [list_custom_field.possible_values.first.value])
+
+ wait_for_reload
+ projects_page.save_query
+
+ projects_page.set_sidebar_filter(my_projects_list.name)
+ projects_page.expect_filter_set("project_status_code", value: "On track")
+
+ projects_page.expect_filter_set(
+ list_custom_field.column_name,
+ value: list_custom_field.possible_values.first.value
+ )
end
it "cannot access another user`s list" do
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 28f24573cb2..fcd1cc82ad6 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -238,7 +238,6 @@ module Pages
def set_advanced_filter(name, human_name, human_operator = nil, values = [], send_keys: false)
selected_filter = select_filter(name, human_name)
- apply_operator(name, human_operator)
within(selected_filter) do
return unless values.any?
@@ -519,7 +518,7 @@ module Pages
end
def project_in_first_row(column_text_separator: "\n")
- first_row = within("#projects-table") { find(".op-project-row-component", match: :first) }
+ first_row = within("#projects-table") { first(".op-project-row-component") }
Project.find_by!(name: first_row.text.split(column_text_separator).first)
end