-
Notifications
You must be signed in to change notification settings - Fork 650
AO3-7035 Add Invitation Mailer Previews and Refactored I18n Keys #5489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hi! Thank you so much for this pull request. Someone will be along to review it soon. I've updated the Jira issue status to In Review so no one will mistakenly create a duplicate pull request. If you'd like the ability to comment on, assign, and transition issues in the future, you're welcome to create a Jira account! It makes things a bit easier for us on the organizational side if the Full Name on your Jira account either closely matches the name you'd like us to credit in the release notes or includes it in parentheses, e.g. "Nickname (CREDIT NAME)." Once you've done that (or if you've already done it -- Jira has been unreliable about showing us new accounts in the admin panel lately), you can either reply here or send an email to otw-coders@transformativeworks.org with your account name and email address and we'll set up the permissions for you. Thanks again for contributing! If you have any questions, you can contact us at the same email address listed above. |
Bilka2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. Since part of this issue is to do a style cleanup, I've pointed out a lot of places where we should make modifications to follow the latest version of our i18n standards.
| <%= t(".has_invited", user_name: style_bold(@user_name)).html_safe %> | ||
| <%= t(".has_invited.html", user_name: style_bold(@user_name)) %> | ||
| <% else %> | ||
| <%= t ".been_invited" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update all t method calls in these emails to use parentheses, as explained in our i18n standards:
| <%= t ".been_invited" %> | |
| <%= t(".been_invited") %> |
|
|
||
| <p> | ||
| <%= t(".html.activation_support", support_link: style_link(t(".html.support_link_text"), new_feedback_report_url)).html_safe %> | ||
| <%= t(".activation_support.html", support_link: style_link(t(".activation_support.support_link_text"), new_feedback_report_url)) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like slavalamp said, please update all link variables and keys in this email to conform to our i18n standards for hyperlinks:
| <%= t(".activation_support.html", support_link: style_link(t(".activation_support.support_link_text"), new_feedback_report_url)) %> | |
| <%= t(".activation_support.html", contact_support_link: style_link(t(".activation_support.contact_support"), new_feedback_report_url)) %> |
| <% if !@user_name.blank? %> | ||
| <%= t(".has_invited", user_name: style_bold(@user_name)).html_safe %> | ||
| <%= t(".has_invited.html", user_name: style_bold(@user_name)) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer username without a space, please update these variables here for that
| subject: "[%{app_name}][%{collection_title}] Invalid sign-ups found" | ||
| invitation: | ||
| about: | ||
| html: The Archive of Our Own (AO3) is a free, noncommercial archive built by and for fans. Our servers are owned by our parent nonprofit, the %{otw_link}, which works to protect fan rights and preserve fanworks. We welcome all kinds of fanworks, including fanfiction, fanart, fanvids, and podfic from any fandom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all these strings, please replace "AO3" with the %{app_name} variable and set that to ArchiveConfig.APP_SHORT_NAME instead of using AO3 directly (refer the general i18n guidelines). Same goes for the longform Archive of Our Own, it should be using a variable that is set to ArchiveConfig.APP_NAME
|
|
||
| # URL: /rails/mailers/user_mailer/invitation | ||
| def invitation_by_other_user | ||
| inviting_user = create(:user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give this user the for_mailer_preview trait.
| faq: | ||
| faq_link_text: our FAQ | ||
| html: For more information, please check %{faq_link}. | ||
| text: For more information, please check %{faq_url}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the exact text to the new location without modifying it:
| text: For more information, please check %{faq_url}. | |
| text: 'For more information, please check our FAQ: %{faq_url}.' |
| join: If you'd like to join us, please %{invitation_link}. | ||
| otw_link_text: Organization for Transformative Works | ||
| support_link_text: contact Support | ||
| text: If you'd like to join us, please follow this link to sign up %{invitation_url}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| text: If you'd like to join us, please follow this link to sign up %{invitation_url}. | |
| text: 'If you''d like to join us, please follow this link to sign up: %{invitation_url}.' |
| activation_support: | ||
| html: After you sign up, you'll receive an account activation email. If you do not receive this email after 48 hours, please %{support_link}. | ||
| support_link_text: contact Support | ||
| text: After you sign up, you'll receive an account activation email. If you do not receive this email after 48 hours, please %{support_url}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| text: After you sign up, you'll receive an account activation email. If you do not receive this email after 48 hours, please %{support_url}. | |
| text: 'After you sign up, you''ll receive an account activation email. If you do not receive this email after 48 hours, please contact Support: %{support_url}.' |
| has_invited: | ||
| html: "%{user_name} has invited you to join the Archive of Our Own!" | ||
| text: "%{user_name} has invited you to join the Archive of Our Own!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the same text in both emails it can just be one key. If it needs the html suffix to avoid html_safe, make the key has_invited_html instead of giving it variants
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-7035
Purpose
This PR introduces the Invitation Mailer Preview functionality and conducts a required I18n refactoring of the invitation email. The refactoring eliminates unsafe practices (like html_safe and view helpers for formatting) to improve code maintainability, rendering safety, and compliance with current I18n standards.
Changes Included
invitation_mailer_preview.rb): A new preview class was added, featuring two necessary variants:invitation_by_other_user: Previews the mailer when an inviter's username is present in the greeting.invitation_by_queue: Previews the generic mailer greeting when the invitation is system-generated.config/locales/*.en.yml) and Templates(app/views/user_mailer/invitation.*.erb):html_safefrom all calls inapp/views/user_mailer/invitation.*.erb.config/locales/*.en.yml): Separated nested keys (e.g.,.html.about) into the standard structure (.about.htmland.about.text). This ensures the I18n system correctly prevents raw HTML from showing in the final message while allowing helpers to be used in the HTML view.Credit
Dcano-png (She/Her)