Repository: getsentry/sentry

Issue:
Auto assign should occur as actor
When using 'Fixes XXX' annotation in a commit, I noticed that while Sentry auto assigned to me (expected), it did so on behalf of itself instead of my user.

![screen shot 2017-08-28 at 9 16 42 am](https://user-images.githubusercontent.com/23610/29782513-b87a5cc0-8bd1-11e7-9fb1-0068f96a0df5.png)



Discussion:

Resolving patch:
diff --git a/src/sentry/receivers/releases.py b/src/sentry/receivers/releases.py
--- a/src/sentry/receivers/releases.py
+++ b/src/sentry/receivers/releases.py
@@ -70,7 +70,8 @@ def resolved_in_commit(instance, created, **kwargs):
                             'commit': instance.id,
                         }
                     )
-                    GroupAssignee.objects.assign(group=group, assigned_to=user_list[0])
+                    GroupAssignee.objects.assign(
+                        group=group, assigned_to=user_list[0], acting_user=user_list[0])
                 else:
                     Activity.objects.create(
                         project_id=group.project_id,


Test patch:
diff --git a/tests/sentry/receivers/test_releases.py b/tests/sentry/receivers/test_releases.py
--- a/tests/sentry/receivers/test_releases.py
+++ b/tests/sentry/receivers/test_releases.py
@@ -1,12 +1,13 @@
 from __future__ import absolute_import
 
+import six
 from hashlib import sha1
 from mock import patch
 from uuid import uuid4
 
 from sentry.models import (
-    Commit, CommitAuthor, GroupAssignee, GroupCommitResolution, OrganizationMember, Release,
-    Repository, TagValue, UserEmail
+    Activity, Commit, CommitAuthor, GroupAssignee, GroupCommitResolution, OrganizationMember,
+    Release, Repository, TagValue, UserEmail
 )
 from sentry.testutils import TestCase
 
@@ -77,7 +78,8 @@ def test_no_matching_group(self):
             key=sha1(uuid4().hex).hexdigest(),
             repository_id=repo.id,
             organization_id=self.organization.id,
-            message='Foo Biz\n\nFixes {}-12F'.format(self.project.slug.upper()),
+            message='Foo Biz\n\nFixes {}-12F'.format(
+                self.project.slug.upper()),
         )
 
         assert not GroupCommitResolution.objects.filter(
@@ -111,7 +113,8 @@ def test_matching_author(self):
 
     def test_assigns_author(self):
         group = self.create_group()
-        user = self.create_user(name='Foo Bar', email='foo@example.com', is_active=True)
+        user = self.create_user(
+            name='Foo Bar', email='foo@example.com', is_active=True)
         email = UserEmail.get_primary_email(user=user)
         email.is_verified = True
         email.save()
@@ -119,7 +122,8 @@ def test_assigns_author(self):
             name='example',
             organization_id=self.group.organization.id,
         )
-        OrganizationMember.objects.create(organization=group.project.organization, user=user)
+        OrganizationMember.objects.create(
+            organization=group.project.organization, user=user)
         commit = Commit.objects.create(
             key=sha1(uuid4().hex).hexdigest(),
             organization_id=group.organization.id,
@@ -138,3 +142,8 @@ def test_assigns_author(self):
         ).exists()
 
         assert GroupAssignee.objects.filter(group=group, user=user).exists()
+
+        self.assertEqual(Activity.objects.filter(project=group.project,
+                                                 group=group,
+                                                 type=Activity.ASSIGNED,
+                                                 user=user,)[0].data, {'assignee': six.text_type(user.id), 'assigneeEmail': user.email})