Browse Source

feat(activity): Use short group ID instead of 'an issue' (#24966)

Evan Purkhiser 3 years ago
parent
commit
eed3f87239

+ 5 - 2
src/sentry/mail/activity/base.py

@@ -188,7 +188,9 @@ class ActivityEmail:
         else:
             name = "Sentry"
 
-        context = {"author": name, "an issue": "an issue"}
+        issue_name = self.group.qualified_short_id or "an issue"
+
+        context = {"author": name, "an issue": issue_name}
         context.update(params)
 
         return description.format(**context)
@@ -204,7 +206,8 @@ class ActivityEmail:
 
         author = mark_safe(fmt.format(self.avatar_as_html(), escape(name)))
 
-        an_issue = f'<a href="{escape(self.get_group_link())}">an issue</a>'
+        issue_name = escape(self.group.qualified_short_id or "an issue")
+        an_issue = f'<a href="{escape(self.get_group_link())}">{issue_name}</a>'
 
         context = {"author": author, "an issue": an_issue}
         context.update(params)

+ 1 - 0
src/sentry/web/frontend/debug/mail.py

@@ -93,6 +93,7 @@ def make_group_generator(random, project):
 
         group = Group(
             id=id,
+            short_id=id,
             project=project,
             culprit=culprit,
             level=level,

+ 1 - 1
tests/fixtures/emails/assigned.txt

@@ -1,6 +1,6 @@
 # Assigned
 
-foo@example.com assigned an issue to foo@example.com
+foo@example.com assigned PROJECT-1 to foo@example.com
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/assigned_self.txt

@@ -1,6 +1,6 @@
 # Assigned
 
-foo@example.com assigned an issue to themselves
+foo@example.com assigned PROJECT-1 to themselves
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/regression.txt

@@ -1,6 +1,6 @@
 # Regression
 
-Sentry marked an issue as a regression
+Sentry marked PROJECT-1 as a regression
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/regression_with_version.txt

@@ -1,6 +1,6 @@
 # Regression
 
-Sentry marked an issue as a regression in abcdef
+Sentry marked PROJECT-1 as a regression in abcdef
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/resolved.txt

@@ -1,6 +1,6 @@
 # Resolved Issue
 
-Sentry marked an issue as resolved
+Sentry marked PROJECT-1 as resolved
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/resolved_in_release.txt

@@ -1,6 +1,6 @@
 # Resolved Issue
 
-Sentry marked an issue as resolved in abcdef
+Sentry marked PROJECT-1 as resolved in abcdef
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/resolved_in_release_upcoming.txt

@@ -1,6 +1,6 @@
 # Resolved Issue
 
-Sentry marked an issue as resolved in an upcoming release
+Sentry marked PROJECT-1 as resolved in an upcoming release
 
 
 ## Issue Details

+ 1 - 1
tests/fixtures/emails/unassigned.txt

@@ -1,6 +1,6 @@
 # Unassigned
 
-foo@example.com unassigned an issue
+foo@example.com unassigned PROJECT-1
 
 
 ## Issue Details