Skip to content
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

[ i18n sprint ] Decouple email templates and translations #334

Merged
merged 2 commits into from
Nov 8, 2022

Conversation

litvinovg
Copy link
Member

@litvinovg litvinovg commented Oct 11, 2022

Companion Vitro-languages PR
Modified FreemarkerEmailMessage and classes that used it:
Removed EmailDirective and error-email.ftl
Send email in separate thread to prevent web interface delays.
With this PR translations, extracted from email templates into property files could be used.
#How to test#

  1. Configure email settings
    For each of installed languages execute following actions:
  2. Create new user, e-mail to the user about created account should be received.
  3. Use the link from the e-mail, set user password, you should receive e-mail after password is set.
  4. Try reset user's password, e-mail to the user about created account should be received.
  5. Try to log in as a user and change e-mail address, you should receive e-mail about that.
  6. Break your page-home.ftl and open home page, you should see "There was an error in the system. This error has been reported to the site administrator. " Check email in administrator's mailbox

Interested parties

@VIVO-project/vivo-committers

@chenejac chenejac self-requested a review October 21, 2022 09:31
Copy link
Member

@brianjlowe brianjlowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me overall. I don't have an easy way of testing email transmission with real SMTP at the moment, but am inclined to approve the PR. One question inline regarding the asynchronous transmission.

return true;
} catch (MessagingException e) {
log.error("Failed to send message.", e);
return false;
}
}

private void sendMessage(MimeMessage msg) {
Thread thread = new Thread() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the asynchronous send? I think we already have a problem where the GUI claims that emails were sent successfully even if errors occurred. It seems that this might make that harder to address.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before that if smtp server have some delays 20-120 sec (it is one of greylisting approaches) then web interface will freeze for that period.
I agree, current notification about successfully sent email is misleading. I guess It should be replaced with something like "The message is going to be sent shortly" and an option to look up the results in notifications journal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable. I guess I had never encountered delays that long, but that would certainly be something to avoid. We should have a better way of verifying that emails were sent, but that seems out of scope for this PR.

@brianjlowe
Copy link
Member

Not merging yet pending approval of companion PR.

@chenejac chenejac merged commit 403cd65 into vivo-project:i18n-redesign Nov 8, 2022
ghost pushed a commit that referenced this pull request Feb 23, 2023
* Decouple email templates and translations

* provide siteName variable to error templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants