Skip to content

Commit a2aa289

Browse files
fix(replays): remove replay from desktop and mobile projects (#54749)
Fixes #49464 by removing replay buttons/references in Issues, for projects that are mobile or desktop. ### **Issue details:** BEFORE <img width="885" alt="SCR-20230815-jouw" src="https://github.com/getsentry/sentry/assets/56095982/0724eec1-f5e3-41ad-8ec4-62aac86584e9"> AFTER <img width="773" alt="SCR-20230814-simc" src="https://github.com/getsentry/sentry/assets/56095982/420fdb48-cdf2-4a61-af0c-d5853eafb04e"> ### **All events table:** BEFORE <img width="1138" alt="SCR-20230815-joqh" src="https://github.com/getsentry/sentry/assets/56095982/a08aebbb-05cc-4a8f-944f-ff8b3f84d343"> AFTER <img width="1126" alt="SCR-20230815-josn" src="https://github.com/getsentry/sentry/assets/56095982/9f443d84-68d2-49cc-9056-4fc1e8fe4b14">
1 parent 4fd9e33 commit a2aa289

File tree

5 files changed

+78
-9
lines changed

5 files changed

+78
-9
lines changed

static/app/components/eventOrGroupExtraDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {tct} from 'sentry/locale';
1616
import {space} from 'sentry/styles/space';
1717
import type {Group, Organization} from 'sentry/types';
1818
import {Event} from 'sentry/types/event';
19+
import {projectCanLinkToReplay} from 'sentry/utils/replays/projectSupportsReplay';
1920
import withOrganization from 'sentry/utils/withOrganization';
2021

2122
type Props = {
@@ -51,7 +52,8 @@ function EventOrGroupExtraDetails({
5152

5253
const issuesPath = `/organizations/${organization.slug}/issues/`;
5354

54-
const showReplayCount = organization.features.includes('session-replay');
55+
const showReplayCount =
56+
organization.features.includes('session-replay') && projectCanLinkToReplay(project);
5557
const hasEscalatingIssuesUi = organization.features.includes('escalating-issues');
5658

5759
return (

static/app/views/issueDetails/allEventsTable.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {DiscoverDatasets} from 'sentry/utils/discover/types';
1414
import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
1515
import {platformToCategory} from 'sentry/utils/platform';
1616
import {useApiQuery} from 'sentry/utils/queryClient';
17+
import {projectCanLinkToReplay} from 'sentry/utils/replays/projectSupportsReplay';
1718
import {useRoutes} from 'sentry/utils/useRoutes';
1819
import EventsTable from 'sentry/views/performance/transactionSummary/transactionEvents/eventsTable';
1920

@@ -107,7 +108,9 @@ type ColumnInfo = {columnTitles: string[]; fields: string[]};
107108

108109
const getColumns = (group: Group, organization: Organization): ColumnInfo => {
109110
const isPerfIssue = group.issueCategory === IssueCategory.PERFORMANCE;
110-
const isReplayEnabled = organization.features.includes('session-replay');
111+
const isReplayEnabled =
112+
organization.features.includes('session-replay') &&
113+
projectCanLinkToReplay(group.project);
111114

112115
// profiles only exist on transactions, so this only works with
113116
// performance issues, and not errors

static/app/views/issueDetails/groupEventCarousel.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
getShortEventId,
3636
} from 'sentry/utils/events';
3737
import getDynamicText from 'sentry/utils/getDynamicText';
38+
import {projectCanLinkToReplay} from 'sentry/utils/replays/projectSupportsReplay';
3839
import useCopyToClipboard from 'sentry/utils/useCopyToClipboard';
3940
import {useLocation} from 'sentry/utils/useLocation';
4041
import useMedia from 'sentry/utils/useMedia';
@@ -246,7 +247,9 @@ export function GroupEventCarousel({event, group, projectSlug}: GroupEventCarous
246247
const xlargeViewport = useMedia(`(min-width: ${theme.breakpoints.xlarge})`);
247248

248249
const hasReplay = Boolean(event?.tags?.find(({key}) => key === 'replayId')?.value);
249-
const isReplayEnabled = organization.features.includes('session-replay');
250+
const isReplayEnabled =
251+
organization.features.includes('session-replay') &&
252+
projectCanLinkToReplay(group.project);
250253
const latencyThreshold = 30 * 60 * 1000; // 30 minutes
251254
const isOverLatencyThreshold =
252255
event.dateReceived &&

static/app/views/issueDetails/header.spec.tsx

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import {ReprocessingStatus} from 'sentry/views/issueDetails/utils';
99
describe('groupDetails', () => {
1010
const baseUrl = 'BASE_URL/';
1111
const organization = TestStubs.Organization();
12-
const project = TestStubs.Project({teams: [TestStubs.Team()]});
12+
const project = TestStubs.Project({
13+
teams: [TestStubs.Team()],
14+
});
1315

14-
describe('issue category: error', () => {
16+
describe('issue category: error, js project', () => {
1517
const defaultProps = {
1618
organization,
1719
baseUrl,
@@ -22,17 +24,28 @@ describe('groupDetails', () => {
2224

2325
it('displays the correct tabs with all features enabled', async () => {
2426
const orgWithFeatures = TestStubs.Organization({
25-
features: ['similarity-view', 'event-attachments'],
27+
features: ['similarity-view', 'event-attachments', 'session-replay'],
2628
});
27-
const projectWithSimilarityView = TestStubs.Project({
29+
const jsProjectWithSimilarityView = TestStubs.Project({
2830
features: ['similarity-view'],
31+
platform: 'javascript',
32+
});
33+
34+
const MOCK_GROUP = TestStubs.Group();
35+
36+
MockApiClient.addMockResponse({
37+
url: `/organizations/${organization.slug}/replay-count/`,
38+
method: 'GET',
39+
body: {
40+
[MOCK_GROUP.id]: ['replay42', 'replay256'],
41+
},
2942
});
3043

3144
render(
3245
<GroupHeader
3346
{...defaultProps}
3447
organization={orgWithFeatures}
35-
project={projectWithSimilarityView}
48+
project={jsProjectWithSimilarityView}
3649
/>,
3750
{organization: orgWithFeatures}
3851
);
@@ -61,8 +74,54 @@ describe('groupDetails', () => {
6174
await userEvent.click(screen.getByRole('tab', {name: /merged issues/i}));
6275
expect(browserHistory.push).toHaveBeenCalledWith('BASE_URL/merged/');
6376

77+
await userEvent.click(screen.getByRole('tab', {name: /replays/i}));
78+
expect(browserHistory.push).toHaveBeenCalledWith('BASE_URL/replays/');
79+
80+
expect(screen.queryByRole('tab', {name: /replays/i})).toBeInTheDocument();
81+
});
82+
});
83+
84+
describe('issue category: error, mobile project', () => {
85+
const defaultProps = {
86+
organization,
87+
baseUrl,
88+
group: TestStubs.Group({issueCategory: IssueCategory.ERROR}),
89+
groupReprocessingStatus: ReprocessingStatus.NO_STATUS,
90+
project,
91+
};
92+
93+
it('displays the correct tabs with all features enabled', async () => {
94+
const orgWithFeatures = TestStubs.Organization({
95+
features: ['similarity-view', 'event-attachments', 'session-replay'],
96+
});
97+
const mobileProjectWithSimilarityView = TestStubs.Project({
98+
features: ['similarity-view'],
99+
platform: 'apple-ios',
100+
});
101+
102+
const MOCK_GROUP = TestStubs.Group();
103+
104+
MockApiClient.addMockResponse({
105+
url: `/organizations/${organization.slug}/replay-count/`,
106+
method: 'GET',
107+
body: {
108+
[MOCK_GROUP.id]: ['replay42', 'replay256'],
109+
},
110+
});
111+
112+
render(
113+
<GroupHeader
114+
{...defaultProps}
115+
organization={orgWithFeatures}
116+
project={mobileProjectWithSimilarityView}
117+
/>,
118+
{organization: orgWithFeatures}
119+
);
120+
64121
await userEvent.click(screen.getByRole('tab', {name: /similar issues/i}));
65122
expect(browserHistory.push).toHaveBeenCalledWith('BASE_URL/similar/');
123+
124+
expect(screen.queryByRole('tab', {name: /replays/i})).not.toBeInTheDocument();
66125
});
67126
});
68127

static/app/views/issueDetails/header.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {space} from 'sentry/styles/space';
2424
import {Event, Group, Organization, Project} from 'sentry/types';
2525
import {getMessage} from 'sentry/utils/events';
2626
import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
27+
import {projectCanLinkToReplay} from 'sentry/utils/replays/projectSupportsReplay';
2728
import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
2829
import {useLocation} from 'sentry/utils/useLocation';
2930
import useOrganization from 'sentry/utils/useOrganization';
@@ -66,7 +67,8 @@ function GroupHeaderTabs({
6667

6768
const hasSimilarView = projectFeatures.has('similarity-view');
6869
const hasEventAttachments = organizationFeatures.has('event-attachments');
69-
const hasReplaySupport = organizationFeatures.has('session-replay');
70+
const hasReplaySupport =
71+
organizationFeatures.has('session-replay') && projectCanLinkToReplay(project);
7072

7173
const issueTypeConfig = getConfigForIssueType(group);
7274

0 commit comments

Comments
 (0)