commit
32442ae00c
4 changed files with 25 additions and 1 deletions
|
@ -15,7 +15,7 @@ class DeviseUserMailer < Devise::Mailer
|
|||
|
||||
def confirmation_instructions(record, token, opts = {})
|
||||
opts[:from] = NO_REPLY_EMAIL
|
||||
@procedure = CurrentConfirmation.procedure_after_confirmation || nil
|
||||
@procedure = opts[:procedure_after_confirmation] || nil
|
||||
super
|
||||
end
|
||||
end
|
||||
|
|
|
@ -295,6 +295,7 @@ class Procedure < ApplicationRecord
|
|||
|
||||
procedure.cloned_from_library = from_library
|
||||
procedure.parent_procedure = self
|
||||
procedure.canonical_procedure = nil
|
||||
|
||||
if from_library
|
||||
procedure.service = nil
|
||||
|
|
|
@ -25,6 +25,20 @@ class User < ApplicationRecord
|
|||
|
||||
before_validation -> { sanitize_email(:email) }
|
||||
|
||||
# Override of Devise::Models::Confirmable#send_confirmation_instructions
|
||||
def send_confirmation_instructions
|
||||
unless @raw_confirmation_token
|
||||
generate_confirmation_token!
|
||||
end
|
||||
|
||||
opts = pending_reconfirmation? ? { to: unconfirmed_email } : {}
|
||||
|
||||
# Make our procedure_after_confirmation available to the Mailer
|
||||
opts[:procedure_after_confirmation] = CurrentConfirmation.procedure_after_confirmation
|
||||
|
||||
send_devise_notification(:confirmation_instructions, @raw_confirmation_token, opts)
|
||||
end
|
||||
|
||||
# Callback provided by Devise
|
||||
def after_confirmation
|
||||
link_invites!
|
||||
|
|
|
@ -538,6 +538,15 @@ describe Procedure do
|
|||
expect(subject.deliberation.attached?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'with canonical procedure' do
|
||||
let(:canonical_procedure) { create(:procedure) }
|
||||
let(:procedure) { create(:procedure, canonical_procedure: canonical_procedure, received_mail: received_mail, service: service) }
|
||||
|
||||
it 'do not clone canonical procedure' do
|
||||
expect(subject.canonical_procedure).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#publish!' do
|
||||
|
|
Loading…
Reference in a new issue