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

ancestors and children of a WP and the WP itself should be excluded from the autocompleter list

Behrokh Satarnejadb2dca5c6edac
diff --git a/app/components/work_package_relations_tab/add_work_package_child_form_component.html.erb b/app/components/work_package_relations_tab/add_work_package_child_form_component.html.erb
index 17142756557..3dae07b4fba 100644
--- a/app/components/work_package_relations_tab/add_work_package_child_form_component.html.erb
+++ b/app/components/work_package_relations_tab/add_work_package_child_form_component.html.erb
@@ -16,6 +16,11 @@
end
end
flex.with_row do
+ # @workpackage is not available inside the render_inline_form block
+ # so we need to re-define them here. Figure out solution for this.
+ ancestors_id = @work_package.ancestors.pluck(:id)
+ children_id = @work_package.children.pluck(:id)
+ non_relatable_wp_ids = [@work_package.id] + ancestors_id + children_id
render_inline_form(f) do |my_form|
my_form.work_package_autocompleter(
name: :id,
@@ -28,6 +33,7 @@
focusDirectly: true,
dropdownPosition: 'bottom',
appendTo: "##{DIALOG_ID}",
+ filters: [{ name: "id", operator: "!", values: non_relatable_wp_ids}],
data: { test_selector: ID_FIELD_TEST_SELECTOR }
}
)