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

Reset the selectTarget after an action has been added. Add type method to user custom field strategies to use the user autocompleter for user custom fields.

Dombi Attila9c35cb4424b2
diff --git a/app/models/custom_actions/actions/custom_field.rb b/app/models/custom_actions/actions/custom_field.rb
index 91c381f3054..374b3406218 100644
--- a/app/models/custom_actions/actions/custom_field.rb
+++ b/app/models/custom_actions/actions/custom_field.rb
@@ -35,14 +35,6 @@ class CustomActions::Actions::CustomField < CustomActions::Actions::Base
raise NotImplementedError
end
- def type
- if custom_field.field_format == "user"
- :user
- else
- super
- end
- end
-
def custom_field
self.class.custom_field
end
diff --git a/app/models/custom_actions/actions/strategies/user_custom_field.rb b/app/models/custom_actions/actions/strategies/user_custom_field.rb
index 3b0bc41e3c9..53ba9431fc8 100644
--- a/app/models/custom_actions/actions/strategies/user_custom_field.rb
+++ b/app/models/custom_actions/actions/strategies/user_custom_field.rb
@@ -30,6 +30,10 @@ module CustomActions::Actions::Strategies::UserCustomField
include CustomActions::Actions::Strategies::CustomField
include ::CustomActions::Actions::Strategies::MeAssociated
+ def type
+ :user
+ end
+
def apply(work_package)
if work_package.respond_to?(custom_field.attribute_setter)
work_package.send(custom_field.attribute_setter, transformed_value(values.first))
diff --git a/frontend/src/stimulus/controllers/dynamic/hide-sections.controller.ts b/frontend/src/stimulus/controllers/dynamic/hide-sections.controller.ts
index 4a856137199..a0ab5f58a05 100644
--- a/frontend/src/stimulus/controllers/dynamic/hide-sections.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/hide-sections.controller.ts
@@ -32,6 +32,7 @@ export default class extends Controller {
}
this.toggleOption(selectedValue);
+ this.selectTarget.selectedIndex = 0;
}
hide(event:MouseEvent) {
diff --git a/spec/models/custom_actions/actions/custom_field_spec.rb b/spec/models/custom_actions/actions/custom_field_spec.rb
index d1b4d7ce2f7..4ba3d4330b8 100644
--- a/spec/models/custom_actions/actions/custom_field_spec.rb
+++ b/spec/models/custom_actions/actions/custom_field_spec.rb
@@ -264,7 +264,7 @@ RSpec.describe CustomActions::Actions::CustomField do
it "is :associated_property" do
expect(instance.type)
- .to be(:associated_property)
+ .to be(:user)
end
describe "current_user special value" do