Skip to content

Commit 2cc0045

Browse files
ted kaemmingmattrobenolt
authored andcommitted
Merge pull request #2598 from getsentry/assignee-emails
Fix assignment notifications.
1 parent 1648538 commit 2cc0045

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/sentry/plugins/sentry_mail/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def notify_about_activity(self, activity):
244244

245245
if activity.type == Activity.ASSIGNED:
246246
# Only notify the assignee, and only if they are in the candidate set.
247-
recipient_ids = candidate_ids & set((activity.data['assignee'],))
247+
recipient_ids = candidate_ids & set(map(int, (activity.data['assignee'],)))
248248
elif activity.type == Activity.NOTE:
249249
recipient_ids = candidate_ids - set(
250250
UserOption.objects.filter(

tests/sentry/plugins/mail/tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,26 @@ def test_notify_digest_single_record(self, send, notify):
263263
assert send.call_count is 1
264264
assert notify.call_count is 1
265265

266+
def test_assignment(self):
267+
activity = Activity.objects.create(
268+
project=self.project,
269+
group=self.group,
270+
type=Activity.ASSIGNED,
271+
user=self.create_user('[email protected]'),
272+
data={
273+
'assignee': str(self.user.id),
274+
},
275+
)
276+
277+
self.plugin.notify_about_activity(activity)
278+
279+
assert len(mail.outbox) == 1
280+
281+
msg = mail.outbox[0]
282+
283+
assert msg.subject == 'Re: [Sentry] [foo Bar] ERROR: Foo bar'
284+
assert msg.to == [self.user.email]
285+
266286
def test_note(self):
267287
user_foo = self.create_user('[email protected]')
268288

0 commit comments

Comments
 (0)