[32131] Only show active projects in custom action condition

https://community.openproject.com/wp/32131
pull/8640/head
Oliver Günther 4 years ago
parent 12e9b25485
commit a33521a1a8
  1. 1
      app/models/custom_actions/conditions/project.rb
  2. 2
      spec/models/custom_actions/conditions/project_spec.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] }

@ -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)

Loading…
Cancel
Save