Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/sentry/models/organizationmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ def send_invite_email(self):
}

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

Expand Down
17 changes: 17 additions & 0 deletions src/sentry/templates/sentry/emails/member-invite.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "sentry/emails/base.html" %}

{% load i18n %}
{% load sentry_helpers %}

{% block main %}
<h3>Welcome to Sentry</h3>
<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>

<p><a href="{{ url }}" class="btn">Join your team</a></p>

<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>
{% endblock %}

{% block footer %}
<a href="{% absolute_uri %}">Home</a>
{% endblock %}
9 changes: 9 additions & 0 deletions src/sentry/templates/sentry/emails/member-invite.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Welcome to Sentry

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.

Join your team by visiting the following url:

{{ url }}

If you'd like to learn more about Sentry before diving head-first, check out our website, https://getsentry.com/
7 changes: 0 additions & 7 deletions src/sentry/templates/sentry/emails/member_invite.txt

This file was deleted.

28 changes: 28 additions & 0 deletions src/sentry/web/frontend/debug/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
Event,
Group,
Organization,
OrganizationMember,
Project,
Rule,
Team,
Expand Down Expand Up @@ -372,6 +373,33 @@ def request_access(request):
).render()


@login_required
def invitation(request):
org = Organization(
id=1,
slug='example',
name='Example',
)
om = OrganizationMember(
id=1,
email='foo@example.com',
organization=org,
)

return MailPreview(
html_template='sentry/emails/member-invite.html',
text_template='sentry/emails/member-invite.txt',
context={
'email': 'foo@example.com',
'organization': org,
'url': absolute_uri(reverse('sentry-accept-invite', kwargs={
'member_id': om.id,
'token': om.token,
})),
},
).render()


@login_required
def access_approved(request):
org = Organization(
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/web/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def init_all_applications():
sentry.web.frontend.debug.mail.request_access),
url(r'^debug/mail/access-approved/$',
sentry.web.frontend.debug.mail.access_approved),
url(r'^debug/mail/invitation/$',
sentry.web.frontend.debug.mail.invitation),
url(r'^debug/embed/error-page/$',
DebugErrorPageEmbedView.as_view()),
url(r'^debug/trigger-error/$',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_valid_for_invites(self):

assert len(mail.outbox) == 1
assert mail.outbox[0].to == ['foo@example.com']
assert mail.outbox[0].subject == 'Invite to join organization: Default'
assert mail.outbox[0].subject == 'Join Default in using Sentry'

def test_existing_user_for_invite(self):
organization = self.create_organization()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_reinvite(self):

assert len(mail.outbox) == 1
assert mail.outbox[0].to == ['bar@example.com']
assert mail.outbox[0].subject == 'Invite to join organization: foo'
assert mail.outbox[0].subject == 'Join foo in using Sentry'

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