AO3-4885 i18n challenge assignment #2773

Merged
merged 2 commits into from May 4, 2017

Conversation

Projects
None yet
3 participants
Contributor

cesy commented Mar 4, 2017

https://otwarchive.atlassian.net/browse/AO3-4885

Internationalise the challenge assignment email

Testing

Check that the email you get with your assignment in a gift exchange is still readable in English. Check for "any" character etc. as well as correct pluralisation of e.g. "Fandom: SG-1" vs. "Fandoms: SG-1, SGA".

References

#2286

Credit

Cesy, she

@sarken

sarken approved these changes Mar 5, 2017

This looks good! It might be a good idea to add And the email should not contain "translation missing" in the test, though, just to be extra careful.

Contributor

cesy commented Mar 5, 2017

Good idea, done.

sarken referenced this pull request Mar 5, 2017

Merged

AO3-4884 i18n invite #2772

Owner

sarken commented Apr 25, 2017

Now that we've merged the invitation email, this has merge conflicts that need to be resolved.

Contributor

cesy commented Apr 28, 2017

Merge conflicts sorted.

@sarken

The merge conflict resolution looks good, but I'm afraid I've found a couple instances of HTML running around naked that need to be fixed.

- <p>
- You have been assigned the following request in the <%= style_link(@collection.title, collection_url(@collection)) %> challenge at the Archive of Our Own!
- </p>
+ <p><%= t ".html.part1", link: style_link(@collection.title, collection_url(@collection)) %></p>
@sarken

sarken Apr 28, 2017

Owner

I took a quick look at this PR in my test logs, and this link appears to give exposed HTML: You have been assigned the following request in the &lt;a href=&quot;http://archiveofourown.org/collections/Awesome_Gift_Exchange&quot; style=&quot;color:#990000&quot;&gt;Awesome Gift Exchange&lt;/a&gt; challenge at the Archive of Our Own!

- <p>
- You can look up this assignment from <%= style_link("your Assignments page", user_assignments_url(@assigned_user)) %>.
- </p>
+ <p><%= t ".html.look_up", link: style_link(t(".html.look_up_link"), user_assignments_url(@assigned_user)) %></p>
@sarken

sarken Apr 28, 2017

Owner

This also appears to be giving exposed HTML: You can look up this assignment from &lt;a href=&quot;http://archiveofourown.org/users/myname4/assignments&quot; style=&quot;color:#990000&quot;&gt;your Assignments page&lt;/a&gt;.

spec/mailers/user_mailer_spec.rb
@@ -197,4 +197,53 @@
end
end
end
+
+ describe "challenge assignment" do
+
@houndci-bot

houndci-bot Apr 29, 2017

Extra empty line detected at block body beginning.

@sarken

It looks like there are still some merge conflicts on this as well.

config/locales/en.yml
@@ -247,6 +247,26 @@ en:
para1: "The following abuse report has been sent to the Abuse team:"
url_para: "URL of the page the abuse is on:"
description_para: "Description of the abuse:"
+ challenge_assignment_notification:
+ subject: "[%{app_name}] [%{collection_title}] Your Assignment!"
@sarken

sarken May 1, 2017

Owner

This didn't originally have a space between "[AO3][Collection Title]": "[#{ArchiveConfig.APP_SHORT_NAME}][#{@collection.title}] Your Assignment!"

Do the other collection emails have a space there?

@cesy

cesy May 1, 2017

Contributor

You're right, the challenge ones don't - I got confused by the other user mailer ones that do.

config/locales/en.yml
+ text:
+ part1: "You have been assigned the following request in the %{collection_title} (%{collection_url}) challenge at the Archive of Our Own!"
+ look_up: "You can look up this assignment from your Assignments page at %{link}."
+ footer: "You're receiving this email because you signed up for the %{title} challenge (%{url}). For more information about this challenge and contact information for the moderators, please see %{profile_url}."
@sarken

sarken May 1, 2017

Owner

We can make a separate issue for this if you prefer, but I just noticed the text email says "please see" while the HTML one says "please visit," which is probably better phrasing.

@cesy

cesy May 1, 2017

Contributor

That's easy to sort - fixed.

app/mailers/user_mailer.rb
@@ -220,7 +220,7 @@ def challenge_assignment_notification(collection_id, assigned_user_id, assignmen
@request = (assignment.request_signup || assignment.pinch_request_signup)
mail(
to: @assigned_user.email,
- subject: "[#{ArchiveConfig.APP_SHORT_NAME}][#{@collection.title}] Your Assignment!"
+ subject: t("user_mailer.challenge_assignment_notification.subject", app_name: ArchiveConfig.APP_SHORT_NAME, collection_title: @collection.title).to_s
@sarken

sarken May 1, 2017

Owner

I don't think we usually need to_s on the end -- did this not work without it?

@cesy

cesy May 1, 2017

Contributor

I can't remember, so will give it another test.

spec/mailers/user_mailer_spec.rb
+ let(:email) { UserMailer.challenge_assignment_notification(collection.id, otheruser.id, open_assignment.id).deliver }
+
+ # Test the headers
+ it 'should have a valid from line' do
@sarken

sarken May 1, 2017

Owner

Not super important because the rest of this file seems to have it, but just an fyi: "should" isn't really necessary -- writing it like "has a valid from line" helps keeps things shorter.

@cesy

cesy May 1, 2017

Contributor

Easy enough to fix while I'm in the file :) and makes it easier to read in the future.

spec/mailers/user_mailer_spec.rb
+ end
+
+ describe "challenge assignment" do
+
@houndci-bot

houndci-bot May 1, 2017

Extra empty line detected at block body beginning.

spec/mailers/user_mailer_spec.rb
@@ -245,4 +245,53 @@
end
end
end
+
+ describe "challenge assignment" do
+
@houndci-bot

houndci-bot May 1, 2017

Extra empty line detected at block body beginning.

@cesy cesy AO3-4885 review comments
cd4c051
Contributor

cesy commented May 1, 2017

This should now be working and ready for another review.

@sarken

sarken approved these changes May 1, 2017

I think this is ready now, yay! Thanks!

@sarken sarken merged commit 15995a4 into otwcode:master May 4, 2017

3 checks passed

Scrutinizer 20 new issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound No violations found. Woof!

cesy deleted the cesy:AO3-4885i18nchallengeassignment branch May 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment