From c61619b6ef09883c3bca83f53cc1ed0578920265 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Tue, 28 Nov 2017 16:40:34 +0100 Subject: [PATCH] limit custom field filters by cf visibility --- app/models/queries/projects/filters/custom_field_filter.rb | 2 +- .../queries/projects/filters/custom_field_filter_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/queries/projects/filters/custom_field_filter.rb b/app/models/queries/projects/filters/custom_field_filter.rb index 9cf94b96b2..8d8e5132be 100644 --- a/app/models/queries/projects/filters/custom_field_filter.rb +++ b/app/models/queries/projects/filters/custom_field_filter.rb @@ -53,7 +53,7 @@ class Queries::Projects::Filters::CustomFieldFilter < def self.custom_fields(_context) custom_field_class - .all + .visible end private diff --git a/spec/models/queries/projects/filters/custom_field_filter_spec.rb b/spec/models/queries/projects/filters/custom_field_filter_spec.rb index b6a4169bcd..da5919d8c6 100644 --- a/spec/models/queries/projects/filters/custom_field_filter_spec.rb +++ b/spec/models/queries/projects/filters/custom_field_filter_spec.rb @@ -80,7 +80,7 @@ describe Queries::Projects::Filters::CustomFieldFilter, type: :model do before do allow(ProjectCustomField) - .to receive_message_chain(:all, :exists?) + .to receive_message_chain(:visible, :exists?) .and_return(true) end @@ -301,7 +301,7 @@ describe Queries::Projects::Filters::CustomFieldFilter, type: :model do describe '.all_for' do before do allow(ProjectCustomField) - .to receive_message_chain(:all) + .to receive(:visible) .and_return([list_project_custom_field, bool_project_custom_field, int_project_custom_field,