[fix #1097] Add whitelist mechanisme to procedure
This commit is contained in:
parent
f1b7a03b63
commit
6a2b575027
4 changed files with 14 additions and 2 deletions
|
@ -16,7 +16,7 @@ class FindDubiousProceduresJob < ApplicationJob
|
|||
.joins(:procedure)
|
||||
.where("types_de_champ.libelle ~* '#{forbidden_regexp}'")
|
||||
.where(type_champ: %w(text textarea))
|
||||
.where(procedures: { archived_at: nil })
|
||||
.where(procedures: { archived_at: nil, whitelisted_at: nil })
|
||||
|
||||
dubious_procedures_and_tdcs = forbidden_tdcs
|
||||
.group_by(&:procedure_id)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddWhitelistedAtColumnToProcedure < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :procedures, :whitelisted_at, :datetime
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171214155554) do
|
||||
ActiveRecord::Schema.define(version: 20180105152235) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -424,6 +424,7 @@ ActiveRecord::Schema.define(version: 20171214155554) do
|
|||
t.datetime "published_at"
|
||||
t.datetime "hidden_at"
|
||||
t.datetime "archived_at"
|
||||
t.datetime "whitelisted_at"
|
||||
t.index ["hidden_at"], name: "index_procedures_on_hidden_at", using: :btree
|
||||
end
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
|||
.with([[procedure, forbidden_tdcs]])
|
||||
end
|
||||
|
||||
context 'and a whitelisted procedure' do
|
||||
let(:procedure) { create(:procedure, whitelisted_at: DateTime.now) }
|
||||
|
||||
it { expect(AdministrationMailer).not_to have_received(:dubious_procedures) }
|
||||
end
|
||||
|
||||
context 'and a archived procedure' do
|
||||
let(:procedure) { create(:procedure, archived_at: DateTime.now) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue