use root_account in enrollment reg. message

fixes VICE-1267
flag=none

test plan: updated spec passes

Change-Id: Ie36649c5f3c08e64cf8523ad48f94b6567861d4d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262347
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Reviewed-by: Jeffrey Johnson <jeffrey.johnson@instructure.com>
QA-Review: Jeffrey Johnson <jeffrey.johnson@instructure.com>
Product-Review: Jeffrey Johnson <jeffrey.johnson@instructure.com>
This commit is contained in:
Caleb Guanzon 2021-04-06 11:10:52 -06:00
parent f63cba7b55
commit 7bbf4bcdc5
3 changed files with 9 additions and 5 deletions

View File

@ -7,7 +7,7 @@
<% end %>
<%= t "You've been invited to participate in a class at %{account}. The class is called %{course}. Course role: %{role_type}",
:account => asset.course.account.name, :course => asset.course.name, :role_type => asset.readable_role_name %>
:account => asset.course.root_account.name, :course => asset.course.name, :role_type => asset.readable_role_name %>
<% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %>
<%= before_label :name, "Name" %> <%= asset.user.name %>

View File

@ -8,7 +8,7 @@
<p>
<%= t :body, "You've been invited to participate in a class at %{account}. The class is called %{course}. Course role: %{role_type}",
:account => asset.course.account.name, :course => asset.course.name, :role_type => asset.readable_role_name %>
:account => asset.course.root_account.name, :course => asset.course.name, :role_type => asset.readable_role_name %>
</p>
<table border="0" style="font-size: 14px; color: #444444;

View File

@ -23,8 +23,11 @@ require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_registration' do
before :once do
course_with_student
@user.workflow_state = 'creation_pending'
@root_account = Account.create(name: 'My Root Account')
@sub_account = Account.create(name:'My Sub-account', parent_account: @root_account)
@user1 = user_factory
course_with_student(:account => @sub_account, :user => @user1)
@user1.workflow_state = 'creation_pending'
end
let(:asset) { @enrollment }
@ -37,7 +40,8 @@ describe 'enrollment_registration' do
Notification.find_or_create_by!(category: "Registration", name: notification_name)
msg = generate_message(notification_name, :email, asset)
# this means the account name is not enclosed in a link
expect(msg.html_body).to include "participate in a class at Default Account."
expect(msg.html_body).to include "participate in a class at My Root Account."
expect(msg.html_body).not_to include "participate in a class at My Sub-account."
expect(msg.html_body).not_to include "Update your notification settings"
expect(msg.html_body).not_to include "Click here to view course page"
expect(@message.body).not_to include 'To change or turn off email notifications,'