Browse Source

Fix special character encoding in project invite emails

pull/770/head
Pēteris Caune 1 year ago
parent
commit
2bf0d0dbc5
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
  1. 1
      CHANGELOG.md
  2. 8
      hc/accounts/tests/test_project.py
  3. 2
      templates/emails/login-subject.html

1
CHANGELOG.md

@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- Fix the Signal integration to handle unexpected RPC messages better (#763)
- Fix special character encoding in Signal notifications (#767)
- Fix project sort order to be case-insensitive everywhere in the UI (#768)
- Fix special character encoding in project invite emails
## v2.5 - 2022-12-14

8
hc/accounts/tests/test_project.py

@ -91,6 +91,10 @@ class ProjectTestCase(BaseTestCase):
self.assertEqual(r.status_code, 403)
def test_it_adds_team_member(self):
# Use "'" in the name to see if does or doesn't get escaped in email subject:
self.project.name = "Alice's Project"
self.project.save()
self.client.login(username="alice@example.org", password="password")
form = {"invite_team_member": "1", "email": "frank@example.org", "role": "w"}
@ -111,8 +115,8 @@ class ProjectTestCase(BaseTestCase):
self.assertFalse(member.user.project_set.exists())
# And an email should have been sent
subj = f"You have been invited to join Alices Project on {settings.SITE_NAME}"
self.assertHTMLEqual(mail.outbox[0].subject, subj)
subj = f"You have been invited to join Alice's Project on {settings.SITE_NAME}"
self.assertEqual(mail.outbox[0].subject, subj)
def test_it_adds_readonly_team_member(self):
self.client.login(username="alice@example.org", password="password")

2
templates/emails/login-subject.html

@ -1,6 +1,6 @@
{% load hc_extras %}
{% if inviting_project %}
You have been invited to join {{ inviting_project }} on {% site_name %}
You have been invited to join {{ inviting_project|safe }} on {% site_name %}
{% else %}
Log in to {% site_name %}
{% endif %}
Loading…
Cancel
Save