Browse Source

fix(workflow): Handle assignment messages on activity tab (#34952)

Fix race condition for user assignment message. This doesn't fail consistently, but assignment message to user sometimes will display 'unknown user' until refresh or clicking the tab again to display the correct user.

FIXES WOR-1842
Kelly Carino 2 years ago
parent
commit
ffcee722ff

+ 1 - 0
static/app/types/group.tsx

@@ -308,6 +308,7 @@ export type GroupActivityAssigned = GroupActivityBase & {
     assignee: string;
     assigneeType: string;
     user: Team | User;
+    assigneeEmail?: string;
   };
   type: GroupActivityType.ASSIGNED;
 };

+ 2 - 5
static/app/views/organizationGroupDetails/groupActivityItem.tsx

@@ -7,7 +7,6 @@ import Link from 'sentry/components/links/link';
 import PullRequestLink from 'sentry/components/pullRequestLink';
 import Version from 'sentry/components/version';
 import {t, tct, tn} from 'sentry/locale';
-import MemberListStore from 'sentry/stores/memberListStore';
 import TeamStore from 'sentry/stores/teamStore';
 import {
   GroupActivity,
@@ -93,12 +92,10 @@ function GroupActivityItem({activity, orgSlug, projectId, author}: Props) {
       return tct('[author] assigned this issue to themselves', {author});
     }
 
-    assignee = MemberListStore.getById(data.assignee);
-
-    if (typeof assignee === 'object' && assignee?.email) {
+    if (data.assigneeType === 'user' && data.assigneeEmail) {
       return tct('[author] assigned this issue to [assignee]', {
         author,
-        assignee: assignee.email,
+        assignee: data.assigneeEmail,
       });
     }