improve wording around links in plain text message templates

prefer wording like "clicking this link: %{link}" over "clicking the
link below" or "clicking the following link"

fixes CNVS-24646

test plan:
- verify that the following notifications work when delivered as plain
  text (not html) email:
    added_to_conversation
    announcement_reply
    conversation_created
    conversation_message
    group_membership_accepted
    group_membership_rejected
    new_context_group_membership
    new_context_group_membership_invitation
    new_discussion_entry
    new_student_organized_group
    peer_review_invitation
    submission_comment
    submission_comment_for_teacher
- also verify that peer_review_invivataion works when delivered as an
  sms or in a summary email (again plain text)

Change-Id: I6d36f797de3a3162fa27a4ce3f7cc423a85e3ff7
Reviewed-on: https://gerrit.instructure.com/66079
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
This commit is contained in:
Simon Williams 2015-10-29 11:03:25 -06:00
parent f9dae39292
commit 922b188051
17 changed files with 66 additions and 53 deletions

View File

@ -7,6 +7,9 @@
<% define_content :subject do %>
<%= t :subject, "%{user_name} just added you to a conversation in Canvas.", :user_name => content(:user_name) %>
<% end %>
<%= t :body, "%{user_name} just added you to a conversation in Canvas. To view the conversation, click the link below:", :user_name => content(:user_name) %>
<%= content :link %>
<%=
t("%{user_name} just added you to a conversation in Canvas. To view the conversation, click this link: %{link}.", {
:user_name => content(:user_name),
:link => content(:link)
})
%>

View File

@ -10,5 +10,4 @@
<%= html_to_text(asset.message, :base_url => dashboard_url) %>
<%= t :discussion_entry_reply_message, "Join the conversation using the link below, or comment by replying to this message." %>
<%= content :link %>
<%= t("Comment by replying to this message, or join the conversation using this link: %{link}.", link: content(:link)) %>

View File

@ -24,13 +24,11 @@
<%= asset.body %>
<% if asset.has_media_objects? %>
<%= t :audio_comment, "This message includes media comments. To listen or reply, click the link below:" %>
<%= t("This message includes media comments. To listen or reply, click this link: %{link}.", link: content(:link)) %>
<% else %>
<%= t :reply_to_conversation_message, "You can reply to this message in Canvas by replying directly to this email." %>
<%= t("You can reply to this message in Canvas by replying directly to this email, or by clicking this link: %{link}.", link: content(:link)) %>
<% end %>
<%= content :link %>
<% unless asset.attachments.empty? %>
<%= t :attached_files, "Attached Files:" %>
<% asset.attachments.each do |attachment| %>

View File

@ -24,13 +24,11 @@
<%= asset.body %>
<% if asset.has_media_objects? %>
<%= t :audio_comment, "This message includes media comments. To listen or reply, click the link below:" %>
<%= t("This message includes media comments. To listen or reply, click this link: %{link}.", link: content(:link)) %>
<% else %>
<%= t :reply_to_conversation_message, "You can reply to this message in Canvas by replying directly to this email." %>
<%= t("You can reply to this message in Canvas by replying directly to this email, or by clicking this link: %{link}.", link: content(:link)) %>
<% end %>
<%= content :link %>
<% unless asset.attachments.empty? %>
<%= t :attached_files, "Attached Files:" %>
<% asset.attachments.each do |attachment| %>

View File

@ -12,5 +12,4 @@
<%= t('course_group', "Your request to join the group %{group_name} for the course %{course_name} has been accepted.", :group_name => asset.group.name, :course_name => asset.group.context.name) %>
<% end %>
<%= before_label('click_below', 'You can check out the group by clicking the link below') %>
<%= content :link %>
<%= t('You can check out the group by clicking this link: %{link}.', link: content(:link)) %>

View File

@ -12,5 +12,4 @@
<%= t('course_group', "Your request to join the group %{group_name} for the course %{course_name} has been rejected.", :group_name => asset.group.name, :course_name => asset.group.context.name) %>
<% end %>
<%= before_label('click_below', 'You can check out other groups by clicking the link below') %>
<%= content :link %>
<%= t('You can check out other groups by clicking this link: %{link}', link: content(:link)) %>

View File

@ -19,9 +19,8 @@
<%=
case asset.group.context_type
when 'Account'
t :details_account, "You can see which groups you're a part of for this account by clicking the link below:"
t("You can see which groups you're a part of for this account by clicking this link: %{link}.", link: content(:link))
else
t :details_account, "You can see which groups you're a part of for this account by clicking the link below:"
t("You can see which groups you're a part of for this course by clicking this link: %{link}.", link: content(:link))
end
%>
<%= content :link %>

View File

@ -16,5 +16,4 @@
end
%>
<%= t :details, "You can check out the group by clicking the link below:" %>
<%= content :link %>
<%= t("You can check out the group by clicking this link: %{link}.", link: content(:link)) %>

View File

@ -10,5 +10,4 @@
<%= html_to_text(asset.message, :base_url => dashboard_url) %>
<%= t :discussion_entry_reply_message, "Join the conversation using the link below, or comment by replying to this message." %>
<%= content :link %>
<%= t("Comment by replying to this message, or join the conversation using this link: %{link}.", link: content(:link)) %>

View File

@ -16,5 +16,4 @@
end
%>
<%= t :details, "You can see details for this group by clicking the link below:" %>
<%= content :link %>
<%= t("You can see details for this group by clicking this link: %{link}.", link: content(:link)) %>

View File

@ -6,6 +6,9 @@
<%= t('#messages.peer_review_invitation.email.subject', "Assigned peer review for %{reviewee}", :reviewee => reviewee_name(asset, user))%>
<% end %>
<%= t('#messages.peer_review_invitation.email.body', "You've been invited to peer review %{reviewee}. Follow the link below to review them!", :reviewee => reviewee_name(asset, user))%>
<%= content :link %>
<%=
t("You've been invited to peer review %{reviewee}. Follow this link to review them: %{link}.", {
reviewee: reviewee_name(asset, user),
link: content(:link)
})
%>

View File

@ -1,4 +1,3 @@
<%= t('#messages.peer_review_invitation.summary.body', "You've been invited to peer review %{reviewee}. Follow the link below to review them!", :reviewee => reviewee_name(asset, user))%>
<%= t("You've been invited to peer review %{reviewee}.", reviewee: reviewee_name(asset, user)) %>
<%= t :more_info, "More info at %{url}", :url => HostUrl.context_host(asset.context) %>

View File

@ -6,4 +6,9 @@
<%= t('#messages.peer_review_invitation.email.subject', "Assigned peer review for %{reviewee}", :reviewee => reviewee_name(asset, user))%>
<% end %>
<%= t('#messages.peer_review_invitation.email.body', "You've been invited to peer review %{reviewee}. Follow the link below to review them!", :reviewee => reviewee_name(asset, user))%>
<%=
t("You've been invited to peer review %{reviewee}. Follow this link to review them: %{link}.", {
reviewee: reviewee_name(asset, user),
link: content(:link)
})
%>

View File

@ -17,17 +17,15 @@
<%= asset.comment %>
<% if asset.media_comment? %>
<%= t "#messages.conversation_message.email.audio_comment", "This message includes media comments. To listen or reply, click the link below:" %>
<%= t("This message includes media comments. To listen or reply, click this link: %{link}.", link: content(:link)) %>
<% else %>
<%= t :link_message, "You can review the submission details here:" %>
<%= t("You can review the submission details by clicking this link: %{link}.", link: content(:link)) %>
<% end %>
<%= content :link %>
<% unless asset.attachments.empty? %>
<%= t "#messages.conversation_message.email.attached_files", "Attached Files:" %>
<% asset.attachments.each do |attachment| %>
<%= attachment.display_name %> - <%= attachment.readable_size %>
<%= file_download_url(attachment) %>
<% end %>
<%= t "#messages.conversation_message.email.attached_files", "Attached Files:" %>
<% asset.attachments.each do |attachment| %>
<%= attachment.display_name %> - <%= attachment.readable_size %>
<%= file_download_url(attachment) %>
<% end %>
<% end %>

View File

@ -11,17 +11,15 @@
<%= asset.comment %>
<% if asset.media_comment? %>
<%= t "#messages.conversation_message.email.audio_comment", "This message includes media comments. To listen or reply, click the link below:" %>
<%= t("This message includes media comments. To listen or reply, click this link: %{link}.", link: content(:link)) %>
<% else %>
<%= t :submission_comment_link_message, "You can review the submission details using the link below, or can reply to this comment by responding to this message." %>
<%= t("You can reply to this comment by responding to this message, or review the submission details using this link: %{link}.", link: content(:link)) %>
<% end %>
<%= content :link %>
<% unless asset.attachments.empty? %>
<%= t "#messages.conversation_message.email.attached_files", "Attached Files:" %>
<% asset.attachments.each do |attachment| %>
<%= attachment.display_name %> - <%= attachment.readable_size %>
<%= file_download_url(attachment) %>
<% end %>
<%= t "#messages.conversation_message.email.attached_files", "Attached Files:" %>
<% asset.attachments.each do |attachment| %>
<%= attachment.display_name %> - <%= attachment.readable_size %>
<%= file_download_url(attachment) %>
<% end %>
<% end %>

View File

@ -651,13 +651,15 @@ class Message < ActiveRecord::Base
# options - An options hash passed to translate (default: {}).
#
# Returns a translated string.
def translate(key, default, options={})
def translate(*args)
key, options = I18nliner::CallHelpers.infer_arguments(args)
# Add scope if it's present in the model and missing from the key.
if @i18n_scope && key !~ /\A#/
if !options[:i18nliner_inferred_key] && @i18n_scope && key !~ /\A#/
key = "##{@i18n_scope}.#{key}"
end
super(key, default, options)
super(key, options)
end
alias :t :translate

View File

@ -453,6 +453,22 @@ describe Message do
end
end
describe "#translate" do
it "should work with an explicit key" do
message = message_model
message.get_template("new_discussion_entry.email.erb") # populate @i18n_scope
message = message.translate(:key, "value %{link}", link: 'hi')
expect(message).to eq "value hi"
end
it "should work with an implicit key" do
message = message_model
message.get_template("new_discussion_entry.email.erb") # populate @i18n_scope
message = message.translate("value %{link}", link: 'hi')
expect(message).to eq "value hi"
end
end
end
describe '.context_type' do