add link to Course Enrollment email notification

fixes CNVS-29366

When a user is enrolled (not invited) in a course, the email
notification will now include a link to the course. The link is an html
button (similar to the one in Course Invitation emails), and another
link has been added to the footer.

Both of these changes make Course Enrollment emails look more similar
to Course Invitation emails.

Test Plan:

* Enroll an existing user in a course. (Make sure this an Enrollment,
  not an Invitation. One way to do this is to enroll the user using the
  API with URL parameters `enrollment[notify]=true` and
  `enrollment[enrollment_state]=active`)
* View the sent message at http://canvas.docker/users/:user_id/messages
* Verify the HTML version of the email notification has 2 links to the
  course--a large button in the body of the message, and a link in the
  footer

Change-Id: Ic4b2f6312a71aa379bba581fc08230af01b0dfa0
Reviewed-on: https://gerrit.instructure.com/80084
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Andrew Huff <ahuff@instructure.com>
This commit is contained in:
Andrew Huff 2016-05-19 09:03:38 -06:00 committed by Andrew Huff
parent b35a025e06
commit 6b35c95e8d
2 changed files with 19 additions and 4 deletions

View File

@ -11,6 +11,10 @@
<a href="<%= registration_confirmation_url(asset.user.communication_channel.confirmation_code, :host => HostUrl.context_host(asset.course)) %>">
<%= t :complete_registration_link, "Click here to complete registration" %>
</a>
<% else %>
<a href="<%= content(:link) %>">
<%= t(:link, "Click here to view the course page") %>
</a>
<% end %>
<% end %>
@ -38,3 +42,15 @@
</tr>
<% end %>
</table>
<br><br>
<table width="100%" border="0" style="text-align:center;">
<tr>
<td>
<a href="<%= content(:link) %>">
<img src="<%= "#{HostUrl.protocol}://#{HostUrl.context_host(asset_context)}" %>/images/get-started-btn.png" alt="Get Started"/>
</a>
</td>
</tr>
</table>

View File

@ -459,10 +459,9 @@ class Message < ActiveRecord::Base
# Returns message body
def populate_body(message_body_template, path_type, _binding, filename)
# Build the body content based on the path type
self.body = Erubis::Eruby.new(message_body_template,
bufvar: '@output_buffer', filename: filename).result(_binding)
self.html_body = apply_html_template(_binding) if path_type == 'email'
self.body = Erubis::Eruby.new(message_body_template,
bufvar: '@output_buffer', filename: filename).result(_binding)
self.html_body = apply_html_template(_binding) if path_type == 'email'
# Append a footer to the body if the path type is email
if path_type == 'email'