send confirmation email from federate attributes provisioning
fixes AE-971 Change-Id: Ie0157ae6d12bd7636be83cfd0b52aebee6c57515 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/348837 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jacob Burroughs <jburroughs@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
63932dd0fb
commit
887443f505
|
@ -337,7 +337,10 @@ class AuthenticationProvider < ActiveRecord::Base
|
|||
cc = user.communication_channels.email.by_path(value).first
|
||||
cc ||= user.communication_channels.email.new(path: value)
|
||||
cc.workflow_state = "unconfirmed" if cc.new_record?
|
||||
cc.save! if cc.changed?
|
||||
if cc.changed?
|
||||
cc.save!
|
||||
cc.send_confirmation!(pseudonym.account)
|
||||
end
|
||||
when "locale"
|
||||
# convert _ to -, be lenient about case, and perform fallbacks
|
||||
value = value.tr("_", "-")
|
||||
|
|
|
@ -216,10 +216,16 @@ describe AuthenticationProvider do
|
|||
before do
|
||||
# ensure the federated_attributes hash is normalized
|
||||
aac.valid?
|
||||
user_with_pseudonym
|
||||
user_with_pseudonym(active_all: true)
|
||||
end
|
||||
|
||||
it "handles most attributes" do
|
||||
notification = Notification.create!(name: "Confirm Email Communication Channel", category: "TestImmediately")
|
||||
cc = CommunicationChannel.new
|
||||
expect(CommunicationChannel).to receive(:new) { |attrs|
|
||||
cc.attributes = attrs
|
||||
cc
|
||||
}
|
||||
aac.apply_federated_attributes(@pseudonym,
|
||||
{
|
||||
"display_name" => "Mr. Cutler",
|
||||
|
@ -233,6 +239,7 @@ describe AuthenticationProvider do
|
|||
},
|
||||
purpose: :provisioning)
|
||||
@user.reload
|
||||
expect(cc.messages_sent.keys).to eq [notification.name]
|
||||
expect(@user.short_name).to eq "Mr. Cutler"
|
||||
expect(@user.communication_channels.email.in_state("unconfirmed").pluck(:path)).to include("cody@school.edu")
|
||||
expect(@pseudonym.integration_id).to eq "abc123"
|
||||
|
|
Loading…
Reference in New Issue