Browse Source

ref(issue-priority): Remove frontend references to issue-priority-ui flag (#73063)

Malachi Willey 8 months ago
parent
commit
c398fea8ca

+ 24 - 12
static/app/components/dropdownMenu/index.spec.tsx

@@ -1,6 +1,6 @@
 import {Fragment} from 'react';
 
-import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
+import {render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary';
 
 import {DropdownMenu} from 'sentry/components/dropdownMenu';
 
@@ -93,29 +93,41 @@ describe('DropdownMenu', function () {
 
     // Can be dismissed by clicking outside
     await userEvent.click(screen.getByRole('button', {name: 'Menu A'}));
-    expect(screen.getByRole('menuitemradio', {name: 'Item One'})).toBeInTheDocument();
-    await userEvent.click(document.body);
     expect(
-      screen.queryByRole('menuitemradio', {name: 'Item One'})
-    ).not.toBeInTheDocument();
+      await screen.findByRole('menuitemradio', {name: 'Item One'})
+    ).toBeInTheDocument();
+    await userEvent.click(document.body);
+    await waitFor(() => {
+      expect(
+        screen.queryByRole('menuitemradio', {name: 'Item One'})
+      ).not.toBeInTheDocument();
+    });
 
     // Can be dismissed by pressing Escape
     await userEvent.click(screen.getByRole('button', {name: 'Menu A'}));
-    expect(screen.getByRole('menuitemradio', {name: 'Item One'})).toBeInTheDocument();
-    await userEvent.keyboard('{Escape}');
     expect(
-      screen.queryByRole('menuitemradio', {name: 'Item One'})
-    ).not.toBeInTheDocument();
+      await screen.findByRole('menuitemradio', {name: 'Item One'})
+    ).toBeInTheDocument();
+    await userEvent.keyboard('{Escape}');
+    await waitFor(() => {
+      expect(
+        screen.queryByRole('menuitemradio', {name: 'Item One'})
+      ).not.toBeInTheDocument();
+    });
 
     // When menu A is open, clicking once on menu B's trigger button closes menu A and
     // then opens menu B
     await userEvent.click(screen.getByRole('button', {name: 'Menu A'}));
     expect(screen.getByRole('menuitemradio', {name: 'Item One'})).toBeInTheDocument();
     await userEvent.click(screen.getByRole('button', {name: 'Menu B'}));
+    await waitFor(() => {
+      expect(
+        screen.queryByRole('menuitemradio', {name: 'Item One'})
+      ).not.toBeInTheDocument();
+    });
     expect(
-      screen.queryByRole('menuitemradio', {name: 'Item One'})
-    ).not.toBeInTheDocument();
-    expect(screen.getByRole('menuitemradio', {name: 'Item Two'})).toBeInTheDocument();
+      await screen.findByRole('menuitemradio', {name: 'Item Two'})
+    ).toBeInTheDocument();
   });
 
   it('renders submenus', async function () {

+ 3 - 16
static/app/components/eventOrGroupHeader.tsx

@@ -4,13 +4,12 @@ import styled from '@emotion/styled';
 
 import ErrorBoundary from 'sentry/components/errorBoundary';
 import EventOrGroupTitle from 'sentry/components/eventOrGroupTitle';
-import ErrorLevel from 'sentry/components/events/errorLevel';
 import EventMessage from 'sentry/components/events/eventMessage';
 import GlobalSelectionLink from 'sentry/components/globalSelectionLink';
 import {IconStar} from 'sentry/icons';
 import {tct} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import type {Group, GroupTombstoneHelper, Level, Organization} from 'sentry/types';
+import type {Group, GroupTombstoneHelper, Organization} from 'sentry/types';
 import type {Event} from 'sentry/types/event';
 import {getLocation, getMessage, isTombstone} from 'sentry/utils/events';
 import {useLocation} from 'sentry/utils/useLocation';
@@ -43,20 +42,16 @@ function EventOrGroupHeader({
   query,
   onClick,
   hideIcons,
-  hideLevel,
   eventId,
   grouping = false,
   source,
 }: EventOrGroupHeaderProps) {
   const location = useLocation();
 
-  const hasIssuePriority = organization.features.includes('issue-priority-ui');
-
   function getTitleChildren() {
-    const {level, isBookmarked, hasSeen} = data as Group;
+    const {isBookmarked, hasSeen} = data as Group;
     return (
       <Fragment>
-        {!hideLevel && level && !hasIssuePriority && <GroupLevel level={level} />}
         {!hideIcons && isBookmarked && (
           <IconWrapper>
             <IconStar isSolid color="yellow300" />
@@ -131,7 +126,7 @@ function EventOrGroupHeader({
       <Title>{getTitle()}</Title>
       {eventLocation && <Location>{eventLocation}</Location>}
       <StyledEventMessage
-        level={hasIssuePriority && 'level' in data ? data.level : undefined}
+        level={'level' in data ? data.level : undefined}
         message={getMessage(data)}
         type={data.type}
         levelIndicatorSize="9px"
@@ -190,14 +185,6 @@ const IconWrapper = styled('span')`
   margin-right: 5px;
 `;
 
-const GroupLevel = styled(ErrorLevel)<{level: Level}>`
-  position: absolute;
-  left: -1px;
-  width: 9px;
-  height: 15px;
-  border-radius: 0 3px 3px 0;
-`;
-
 const TitleWithLink = styled(GlobalSelectionLink)`
   display: inline-flex;
   align-items: center;

+ 0 - 20
static/app/components/events/eventMessage.tsx

@@ -5,7 +5,6 @@ import UnhandledTag from 'sentry/components/group/inboxBadges/unhandledTag';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {EventOrGroupType, type Level} from 'sentry/types/event';
-import useOrganization from 'sentry/utils/useOrganization';
 
 type Props = {
   type: EventOrGroupType;
@@ -49,25 +48,6 @@ function EventMessage({
   type,
   showUnhandled = false,
 }: Props) {
-  const organization = useOrganization({allowNull: true});
-  const hasIssuePriority = organization?.features.includes('issue-priority-ui');
-
-  if (!hasIssuePriority) {
-    return (
-      <LevelMessageContainer className={className}>
-        {level ? (
-          <EventOrGroupLevel
-            level={level}
-            levelIndicatorSize={levelIndicatorSize}
-            type={type}
-          />
-        ) : null}
-        {showUnhandled ? <UnhandledTag /> : null}
-        {message ? <Message>{message}</Message> : null}
-      </LevelMessageContainer>
-    );
-  }
-
   return (
     <LevelMessageContainer className={className}>
       <EventOrGroupLevel

+ 3 - 7
static/app/components/issues/groupListHeader.tsx

@@ -3,7 +3,6 @@ import styled from '@emotion/styled';
 import PanelHeader from 'sentry/components/panels/panelHeader';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import useOrganization from 'sentry/utils/useOrganization';
 
 import type {GroupListColumn} from './groupList';
 
@@ -18,8 +17,6 @@ function GroupListHeader({
   narrowGroups = false,
   withColumns = ['graph', 'event', 'users', 'assignee', 'lastTriggered'],
 }: Props) {
-  const organization = useOrganization();
-
   return (
     <PanelHeader disablePadding>
       <IssueWrapper>{t('Issue')}</IssueWrapper>
@@ -30,10 +27,9 @@ function GroupListHeader({
         <EventUserWrapper>{t('events')}</EventUserWrapper>
       )}
       {withColumns.includes('users') && <EventUserWrapper>{t('users')}</EventUserWrapper>}
-      {withColumns.includes('priority') &&
-        organization.features.includes('issue-priority-ui') && (
-          <PriorityWrapper narrowGroups={narrowGroups}>{t('Priority')}</PriorityWrapper>
-        )}
+      {withColumns.includes('priority') && (
+        <PriorityWrapper narrowGroups={narrowGroups}>{t('Priority')}</PriorityWrapper>
+      )}
       {withColumns.includes('assignee') && (
         <AssigneeWrapper narrowGroups={narrowGroups}>{t('Assignee')}</AssigneeWrapper>
       )}

+ 1 - 4
static/app/components/stream/group.spec.tsx

@@ -1,5 +1,4 @@
 import {GroupFixture} from 'sentry-fixture/group';
-import {OrganizationFixture} from 'sentry-fixture/organization';
 import {ProjectFixture} from 'sentry-fixture/project';
 
 import {initializeOrg} from 'sentry-test/initializeOrg';
@@ -106,9 +105,7 @@ describe('StreamGroup', function () {
       body: {priority: PriorityLevel.HIGH},
     });
 
-    render(<StreamGroup id="1337" query="is:unresolved" />, {
-      organization: OrganizationFixture({features: ['issue-priority-ui']}),
-    });
+    render(<StreamGroup id="1337" query="is:unresolved" />);
 
     const priorityDropdown = screen.getByRole('button', {name: 'Modify issue priority'});
     expect(within(priorityDropdown).getByText('Med')).toBeInTheDocument();

+ 2 - 3
static/app/components/stream/group.tsx

@@ -161,7 +161,7 @@ function BaseGroupRow({
       : getRelativeSummary(period || DEFAULT_STATS_PERIOD).toLowerCase());
 
   const sharedAnalytics = useMemo(() => {
-    const tab = getTabs(organization).find(([tabQuery]) => tabQuery === query)?.[1];
+    const tab = getTabs().find(([tabQuery]) => tabQuery === query)?.[1];
     const owners = group?.owners ?? [];
     return {
       organization,
@@ -532,8 +532,7 @@ function BaseGroupRow({
           {withColumns.includes('users') && issueTypeConfig.stats.enabled && (
             <EventCountsWrapper>{groupUsersCount}</EventCountsWrapper>
           )}
-          {organization.features.includes('issue-priority-ui') &&
-          withColumns.includes('priority') ? (
+          {withColumns.includes('priority') ? (
             <PriorityWrapper narrowGroups={narrowGroups}>
               {group.priority ? (
                 <GroupPriority group={group} onChange={onPriorityChange} />

+ 1 - 2
static/app/constants/index.tsx

@@ -222,8 +222,7 @@ export const MAX_PICKABLE_DAYS = 90;
 
 export const DEFAULT_STATS_PERIOD = '14d';
 
-export const DEFAULT_QUERY = 'is:unresolved';
-export const NEW_DEFAULT_QUERY = 'is:unresolved issue.priority:[high, medium]';
+export const DEFAULT_QUERY = 'is:unresolved issue.priority:[high, medium]';
 
 export const DEFAULT_USE_UTC = true;
 

+ 3 - 3
static/app/stores/tagStore.spec.tsx

@@ -50,7 +50,7 @@ describe('TagStore', function () {
         },
       ]);
 
-      expect(TagStore.getIssueAttributes(OrganizationFixture()).has).toEqual({
+      expect(TagStore.getIssueAttributes().has).toEqual({
         key: 'has',
         name: 'Has Tag',
         values: ['mytag', 'otherkey'],
@@ -66,7 +66,7 @@ describe('TagStore', function () {
         },
       ]);
 
-      const tags = TagStore.getIssueAttributes(OrganizationFixture());
+      const tags = TagStore.getIssueAttributes();
       expect(tags.is).toBeTruthy();
       expect(tags.is.key).toBe('is');
       expect(tags.assigned).toBeTruthy();
@@ -80,7 +80,7 @@ describe('TagStore', function () {
         },
       ]);
 
-      const tags = TagStore.getIssueAttributes(OrganizationFixture());
+      const tags = TagStore.getIssueAttributes();
       expect(tags.is.values).toContain('archived');
     });
   });

+ 6 - 9
static/app/stores/tagStore.tsx

@@ -23,7 +23,7 @@ const BUILTIN_TAGS = ISSUE_FIELDS.reduce<TagCollection>((acc, tag) => {
 }, {});
 
 interface TagStoreDefinition extends StrictStoreDefinition<TagCollection> {
-  getIssueAttributes(org: Organization): TagCollection;
+  getIssueAttributes(): TagCollection;
   getIssueTags(org: Organization): TagCollection;
   loadTagsSuccess(data: Tag[]): void;
   reset(): void;
@@ -41,7 +41,7 @@ const storeConfig: TagStoreDefinition = {
   /**
    * Gets only predefined issue attributes
    */
-  getIssueAttributes(org: Organization) {
+  getIssueAttributes() {
     // TODO(mitsuhiko): what do we do with translations here?
     const isSuggestions = [
       'resolved',
@@ -162,16 +162,13 @@ const storeConfig: TagStoreDefinition = {
         values: [],
         predefined: true,
       },
-    };
-
-    if (org.features.includes('issue-priority-ui')) {
-      tagCollection[FieldKey.ISSUE_PRIORITY] = {
+      [FieldKey.ISSUE_PRIORITY]: {
         key: FieldKey.ISSUE_PRIORITY,
         name: 'Issue Priority',
         values: [PriorityLevel.HIGH, PriorityLevel.MEDIUM, PriorityLevel.LOW],
         predefined: true,
-      };
-    }
+      },
+    };
 
     // Ony include fields that that are part of the ISSUE_FIELDS. This is
     // because we may sometimes have fields that are turned off by removing
@@ -193,7 +190,7 @@ const storeConfig: TagStoreDefinition = {
       // State tags should overwrite built ins.
       ...this.state,
       // We want issue attributes to overwrite any built in and state tags
-      ...this.getIssueAttributes(org),
+      ...this.getIssueAttributes(),
     };
     if (!org.features.includes('device-classification')) {
       delete issueTags[FieldKey.DEVICE_CLASS];

+ 4 - 3
static/app/views/alerts/rules/metric/details/relatedIssues.spec.tsx

@@ -58,8 +58,9 @@ describe('metric details -> RelatedIssues', () => {
       },
     });
     // The links should contain the query parameters, our test environment isn't able to update it
-    expect(
-      screen.getByRole('link', {name: /Level: Warning RequestError fetchData/})
-    ).toHaveAttribute('href', expect.stringContaining('environment=test-env'));
+    expect(screen.getByRole('link', {name: /RequestError fetchData/})).toHaveAttribute(
+      'href',
+      expect.stringContaining('environment=test-env')
+    );
   });
 });

Some files were not shown because too many files changed in this diff