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

[32131] Only show active projects in custom action condition

Oliver Günthera33521a1a846
diff --git a/app/models/custom_actions/conditions/project.rb b/app/models/custom_actions/conditions/project.rb
index 62cd1b9a33a..1071d0c664a 100644
--- a/app/models/custom_actions/conditions/project.rb
+++ b/app/models/custom_actions/conditions/project.rb
@@ -37,6 +37,7 @@ class CustomActions::Conditions::Project < CustomActions::Conditions::Base
def associated
::Project
+ .active
.select(:id, :name)
.order(Arel.sql('LOWER(name)'))
.map { |u| [u.id, u.name] }
diff --git a/spec/models/custom_actions/conditions/project_spec.rb b/spec/models/custom_actions/conditions/project_spec.rb
index 0ad044970f4..960beb3aac6 100644
--- a/spec/models/custom_actions/conditions/project_spec.rb
+++ b/spec/models/custom_actions/conditions/project_spec.rb
@@ -37,7 +37,7 @@ describe CustomActions::Conditions::Project, type: :model do
projects = [FactoryBot.build_stubbed(:project),
FactoryBot.build_stubbed(:project)]
allow(Project)
- .to receive_message_chain(:select, :order)
+ .to receive_message_chain(:active, :select, :order)
.and_return(projects)
expect(instance.allowed_values)