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

chore: improve direct invite by allowing html in someone_invited_you #53

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/devise/mailer/direct_invite.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p><%= t("devise.mailer.invitation_instructions.hello", email: @resource.name) %></p>

<p>
<%= t("devise.mailer.invitation_instructions.someone_invited_you", application: @resource.organization.name) %>
<%= t("devise.mailer.invitation_instructions.someone_invited_you", application: @resource.organization.name).html_safe %>
Copy link
Member

Choose a reason for hiding this comment

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

You could include a test to check it's working

</p>

<p><%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, invitation_token: @token, invite_redirect: decidim.root_path, host: @resource.organization.host) %></p>
Expand Down
11 changes: 11 additions & 0 deletions app/views/devise/mailer/invitation_instructions.html.erb
Copy link
Member

Choose a reason for hiding this comment

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

If you monkey-patch this file, add it to the spec/lib/overrides_spec.rb. It makes upgrading the Decidim version of the module easier if all the overridden files and customizations are placed there.

Anyway, could you please explain why have you customized this file?

Copy link
Author

@froger froger Mar 28, 2023

Choose a reason for hiding this comment

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

Thanks for your comment, I will try my best to explain, but will write a test to be sure:

  • when the admin checks "register user", the email that is sent is the devise one (as it goes through the InviteUser command).
  • as we want to have html template for "invitations", this includes direct and registration as well.

Our use-case is a university which will invites all its students, and we need consistency through sent emails.
Will find some time to write tests next week.

Thanks

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p><%= t("devise.mailer.invitation_instructions.hello", email: @resource.email) %></p>

<p><%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url).html_safe %></p>

<p><%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, invitation_token: @token) %></p>

<% if @resource.invitation_due_at %>
<p><%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %></p>
<% end %>

<p><%= t("devise.mailer.invitation_instructions.ignore").html_safe %></p>