apply dir and lang to html notifications

fixes VICE-599

test plan:

- change the student's notification preference for created
    created assignments to "right away"
- change the student's language to "ar"
- create an assignment for that student and publish
- bundle exec rails c
- > DelayedMessage.summarize([DelayedMessage.last])
- visit /users/[this user's id]/messages as an admin
- verify that the notification html is displayed right to left

screenshot rtl demo: https://cl.ly/8f9c242745b0

- change the student's language back to english
- create another assignment for that student, publish
- back to the rails console,
    run > DelayedMessage.summarize([DelayedMessage.last])
- visit that user's /users/[this user's id]/messages page as an admin
- verify the latest notification is to left to right

screenshot of ltr demo: https://cl.ly/2f12dfda3329

Change-Id: I99c6f75b688a0a01e45d3c0071be378af204ebb5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242096
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
This commit is contained in:
Caleb Guanzon 2020-07-07 11:01:37 -06:00
parent 2e853519cf
commit cf114b1c1d
2 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html dir="<%= I18n.rtl? ? 'rtl' : 'ltr' %>" lang="<%= I18n.locale.to_s %>">
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

View File

@ -66,7 +66,7 @@ describe Message do
it "should have a sane body" do
@au = AccountUser.create(:account => account_model)
msg = generate_message(:account_user_notification, :email, @au)
expect(msg.html_body.scan(/<html>/).length).to eq 1
expect(msg.html_body.scan(/<html dir="ltr" lang="en">/).length).to eq 1
expect(msg.html_body.index('<!DOCTYPE')).to eq 0
end