Merge branch 'dev'
This commit is contained in:
commit
4c6cd01139
5 changed files with 54 additions and 47 deletions
2
Gemfile
2
Gemfile
|
@ -1,6 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails'
|
||||
gem 'rails', '~> 5.2.0.rc1'
|
||||
|
||||
# Use SCSS for stylesheets
|
||||
gem 'sass-rails'
|
||||
|
|
81
Gemfile.lock
81
Gemfile.lock
|
@ -30,25 +30,25 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (2.3.6)
|
||||
actioncable (5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
actioncable (5.2.0.rc1)
|
||||
actionpack (= 5.2.0.rc1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
actionview (= 5.1.4)
|
||||
activejob (= 5.1.4)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.0.rc1)
|
||||
actionpack (= 5.2.0.rc1)
|
||||
actionview (= 5.2.0.rc1)
|
||||
activejob (= 5.2.0.rc1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.1.4)
|
||||
actionview (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
actionpack (5.2.0.rc1)
|
||||
actionview (= 5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
actionview (5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
@ -58,20 +58,24 @@ GEM
|
|||
activemodel (>= 4.1, < 6)
|
||||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
activejob (5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
activejob (5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
activemodel (5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (> 5.x)
|
||||
activesupport (> 5.x)
|
||||
builder (~> 3.1)
|
||||
activerecord (5.1.4)
|
||||
activemodel (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
arel (~> 8.0)
|
||||
activesupport (5.1.4)
|
||||
activerecord (5.2.0.rc1)
|
||||
activemodel (= 5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.0.rc1)
|
||||
actionpack (= 5.2.0.rc1)
|
||||
activerecord (= 5.2.0.rc1)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.0.rc1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
|
@ -91,7 +95,7 @@ GEM
|
|||
selectize-rails (~> 0.6)
|
||||
apipie-rails (0.5.6)
|
||||
rails (>= 4.1)
|
||||
arel (8.0.0)
|
||||
arel (9.0.0)
|
||||
ast (2.3.0)
|
||||
attr_required (1.0.1)
|
||||
autoprefixer-rails (7.2.5)
|
||||
|
@ -454,6 +458,8 @@ GEM
|
|||
activesupport (>= 3.1.0)
|
||||
rack (>= 1.4.0)
|
||||
rest-client
|
||||
marcel (0.3.1)
|
||||
mimemagic (~> 0.3.2)
|
||||
maruku (0.7.3)
|
||||
method_source (0.9.0)
|
||||
mime-types (3.1)
|
||||
|
@ -541,17 +547,18 @@ GEM
|
|||
rack
|
||||
rack-test (0.8.2)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.1.4)
|
||||
actioncable (= 5.1.4)
|
||||
actionmailer (= 5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
actionview (= 5.1.4)
|
||||
activejob (= 5.1.4)
|
||||
activemodel (= 5.1.4)
|
||||
activerecord (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
rails (5.2.0.rc1)
|
||||
actioncable (= 5.2.0.rc1)
|
||||
actionmailer (= 5.2.0.rc1)
|
||||
actionpack (= 5.2.0.rc1)
|
||||
actionview (= 5.2.0.rc1)
|
||||
activejob (= 5.2.0.rc1)
|
||||
activemodel (= 5.2.0.rc1)
|
||||
activerecord (= 5.2.0.rc1)
|
||||
activestorage (= 5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.1.4)
|
||||
railties (= 5.2.0.rc1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.2)
|
||||
actionpack (~> 5.x, >= 5.0.1)
|
||||
|
@ -562,9 +569,9 @@ GEM
|
|||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
railties (5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
railties (5.2.0.rc1)
|
||||
actionpack (= 5.2.0.rc1)
|
||||
activesupport (= 5.2.0.rc1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
|
@ -743,7 +750,7 @@ GEM
|
|||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff
|
||||
websocket-driver (0.6.5)
|
||||
websocket-driver (0.7.0)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.3)
|
||||
xml-simple (1.1.5)
|
||||
|
@ -810,7 +817,7 @@ DEPENDENCIES
|
|||
pry-byebug
|
||||
rack-handlers
|
||||
rack-mini-profiler
|
||||
rails
|
||||
rails (~> 5.2.0.rc1)
|
||||
rails-controller-testing
|
||||
rest-client
|
||||
rgeo-geojson
|
||||
|
|
|
@ -6,13 +6,13 @@ module CredentialsSyncableConcern
|
|||
end
|
||||
|
||||
def sync_credentials
|
||||
if email_changed? || encrypted_password_changed?
|
||||
if saved_change_to_email? || saved_change_to_encrypted_password?
|
||||
return force_sync_credentials
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def force_sync_credentials
|
||||
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
|
||||
SyncCredentialsService.new(self.class, email_before_last_save, email, encrypted_password).change_credentials!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -69,7 +69,7 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
before_validation :update_state_dates, if: -> { state_changed? }
|
||||
|
||||
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
||||
after_save :build_default_champs, if: Proc.new { saved_change_to_procedure_id? }
|
||||
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
|
||||
after_save :send_dossier_received
|
||||
after_create :send_draft_notification_email
|
||||
|
@ -308,7 +308,7 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_dossier_received
|
||||
if state_changed? && en_instruction?
|
||||
if saved_change_to_state? && en_instruction?
|
||||
NotificationMailer.send_dossier_received(id).deliver_later
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
class SyncCredentialsService
|
||||
def initialize klass, email_was, email, encrypted_password
|
||||
def initialize klass, email_before_last_save, email, encrypted_password
|
||||
@klass = klass
|
||||
@email_was = email_was
|
||||
@email_before_last_save = email_before_last_save
|
||||
@email = email
|
||||
@encrypted_password = encrypted_password
|
||||
end
|
||||
|
||||
def change_credentials!
|
||||
if @klass != User
|
||||
user = User.find_by(email: @email_was)
|
||||
user = User.find_by(email: @email_before_last_save)
|
||||
if user && !user.update_columns(email: @email, encrypted_password: @encrypted_password)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if @klass != Gestionnaire
|
||||
gestionnaire = Gestionnaire.find_by(email: @email_was)
|
||||
gestionnaire = Gestionnaire.find_by(email: @email_before_last_save)
|
||||
if gestionnaire && !gestionnaire.update_columns(email: @email, encrypted_password: @encrypted_password)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if @klass != Administrateur
|
||||
administrateur = Administrateur.find_by(email: @email_was)
|
||||
administrateur = Administrateur.find_by(email: @email_before_last_save)
|
||||
if administrateur && !administrateur.update_columns(email: @email, encrypted_password: @encrypted_password)
|
||||
return false
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue