Skip to content

Commit 3fc7899

Browse files
committed
Merge pull request #2645 from getsentry/invitation
Update our invitation emails
1 parent 3b02506 commit 3fc7899

File tree

8 files changed

+61
-11
lines changed

8 files changed

+61
-11
lines changed

src/sentry/models/organizationmember.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ def send_invite_email(self):
147147
}
148148

149149
msg = MessageBuilder(
150-
subject='Invite to join organization: %s' % (self.organization.name,),
151-
template='sentry/emails/member_invite.txt',
150+
subject='Join %s in using Sentry' % self.organization.name,
151+
template='sentry/emails/member-invite.txt',
152+
html_template='sentry/emails/member-invite.html',
152153
context=context,
153154
)
154155

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends "sentry/emails/base.html" %}
2+
3+
{% load i18n %}
4+
{% load sentry_helpers %}
5+
6+
{% block main %}
7+
<h3>Welcome to Sentry</h3>
8+
<p>Your teammates over at <strong>{{ organization.name }}</strong> have already been using Sentry without you, but the good news is that you've been invited to join them.</p>
9+
10+
<p><a href="{{ url }}" class="btn">Join your team</a></p>
11+
12+
<p>If you'd like to learn more about Sentry before diving in head-first, check out our website, <a href="https://getsentry.com/">getsentry.com</a></p>
13+
{% endblock %}
14+
15+
{% block footer %}
16+
<a href="{% absolute_uri %}">Home</a>
17+
{% endblock %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Welcome to Sentry
2+
3+
Your teammates over at {{ organization.name }} have already been using Sentry without you, but the good news is that you've been invited to join them.
4+
5+
Join your team by visiting the following url:
6+
7+
{{ url }}
8+
9+
If you'd like to learn more about Sentry before diving head-first, check out our website, https://getsentry.com/

src/sentry/templates/sentry/emails/member_invite.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/sentry/web/frontend/debug/mail.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
Event,
3333
Group,
3434
Organization,
35+
OrganizationMember,
3536
Project,
3637
Rule,
3738
Team,
@@ -372,6 +373,33 @@ def request_access(request):
372373
).render()
373374

374375

376+
@login_required
377+
def invitation(request):
378+
org = Organization(
379+
id=1,
380+
slug='example',
381+
name='Example',
382+
)
383+
om = OrganizationMember(
384+
id=1,
385+
386+
organization=org,
387+
)
388+
389+
return MailPreview(
390+
html_template='sentry/emails/member-invite.html',
391+
text_template='sentry/emails/member-invite.txt',
392+
context={
393+
'email': '[email protected]',
394+
'organization': org,
395+
'url': absolute_uri(reverse('sentry-accept-invite', kwargs={
396+
'member_id': om.id,
397+
'token': om.token,
398+
})),
399+
},
400+
).render()
401+
402+
375403
@login_required
376404
def access_approved(request):
377405
org = Organization(

src/sentry/web/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def init_all_applications():
110110
sentry.web.frontend.debug.mail.request_access),
111111
url(r'^debug/mail/access-approved/$',
112112
sentry.web.frontend.debug.mail.access_approved),
113+
url(r'^debug/mail/invitation/$',
114+
sentry.web.frontend.debug.mail.invitation),
113115
url(r'^debug/embed/error-page/$',
114116
DebugErrorPageEmbedView.as_view()),
115117
url(r'^debug/trigger-error/$',

tests/sentry/web/frontend/test_create_organization_member.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_valid_for_invites(self):
5656

5757
assert len(mail.outbox) == 1
5858
assert mail.outbox[0].to == ['[email protected]']
59-
assert mail.outbox[0].subject == 'Invite to join organization: Default'
59+
assert mail.outbox[0].subject == 'Join Default in using Sentry'
6060

6161
def test_existing_user_for_invite(self):
6262
organization = self.create_organization()

tests/sentry/web/frontend/test_organization_member_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_reinvite(self):
153153

154154
assert len(mail.outbox) == 1
155155
assert mail.outbox[0].to == ['[email protected]']
156-
assert mail.outbox[0].subject == 'Invite to join organization: foo'
156+
assert mail.outbox[0].subject == 'Join foo in using Sentry'
157157

158158
def test_cannot_edit_yourself(self):
159159
organization = self.create_organization(name='foo', owner=self.user)

0 commit comments

Comments
 (0)