From 40b3ea8ad6bb28fc1aa1511819ef6a5627128397 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 13 Jul 2021 18:19:46 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"Instructeurs=20:=20limitation=20de=20?= =?UTF-8?q?la=20valeur=20d'un=20filtre=20=C3=A0=20100=20caract=C3=A8res"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/procedure_presentation.rb | 11 ----------- app/views/instructeurs/procedures/show.html.haml | 2 +- spec/models/procedure_presentation_spec.rb | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 066ef42ca..309b63d31 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -22,8 +22,6 @@ class ProcedurePresentation < ApplicationRecord TYPE_DE_CHAMP = 'type_de_champ' TYPE_DE_CHAMP_PRIVATE = 'type_de_champ_private' - FILTERS_VALUE_MAX_LENGTH = 100 - belongs_to :assign_to, optional: false delegate :procedure, to: :assign_to @@ -32,7 +30,6 @@ class ProcedurePresentation < ApplicationRecord validate :check_allowed_sort_column validate :check_allowed_sort_order validate :check_allowed_filter_columns - validate :check_filters_max_length def fields fields = [ @@ -285,14 +282,6 @@ class ProcedurePresentation < ApplicationRecord end end - def check_filters_max_length - filters.values.flatten.each do |filter| - if filter['value']&.length.to_i > FILTERS_VALUE_MAX_LENGTH - errors.add(:filters, :too_long) - end - end - end - def field_hash(label, table, column) { 'label' => label, diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index 5e2553b7b..062af95c5 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -86,7 +86,7 @@ = select_tag :field, options_for_select(@displayed_fields_options) %br = label_tag :value, "Valeur" - = text_field_tag :value, nil, maxlength: ProcedurePresentation::FILTERS_VALUE_MAX_LENGTH + = text_field_tag :value = hidden_field_tag :statut, @statut %br = submit_tag "Ajouter le filtre", class: 'button' diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb index 9eb2bd6f7..3be47afce 100644 --- a/spec/models/procedure_presentation_spec.rb +++ b/spec/models/procedure_presentation_spec.rb @@ -45,7 +45,6 @@ describe ProcedurePresentation do context 'of filters' do it { expect(build(:procedure_presentation, filters: { "suivis" => [{ "table" => "user", "column" => "reset_password_token", "order" => "asc" }] })).to be_invalid } - it { expect(build(:procedure_presentation, filters: { "suivis" => [{ "table" => "user", "column" => "email", "value" => "A" * 200 }] })).to be_invalid } end end