Skip to content

chore(issues): Remove legacy browser flag from FE #67715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fixtures/js-stubs/projectFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function ProjectFiltersFixture(params = []) {
'This applies to both IPv4 (``127.0.0.1``) and IPv6 (``::1``) addresses.',
},
{
active: ['ie_pre_9', 'ie9'],
active: ['ie', 'safari'],
id: 'legacy-browsers',
name: 'Filter out known errors from legacy browsers',
description:
Expand Down
59 changes: 19 additions & 40 deletions static/app/views/settings/project/projectFilters/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,18 @@ describe('ProjectFilters', function () {

expect(
await screen.findByRole('checkbox', {
name: 'Internet Explorer (Deprecated) Version 8 and lower',
name: 'Internet Explorer Verison 11 and lower',
})
).toBeChecked();

expect(
screen.getByRole('checkbox', {name: 'Internet Explorer (Deprecated) Version 9'})
await screen.findByRole('checkbox', {
name: 'Safari Version 11 and lower',
})
).toBeChecked();

expect(
screen.getByRole('checkbox', {name: 'Internet Explorer (Deprecated) Version 10'})
screen.getByRole('checkbox', {name: 'Firefox Version 66 and lower'})
).not.toBeChecked();
});

Expand All @@ -131,44 +133,22 @@ describe('ProjectFilters', function () {

await userEvent.click(
await screen.findByRole('checkbox', {
name: 'Safari (Deprecated) Version 5 and lower',
name: 'Firefox Version 66 and lower',
})
);
expect(mock.mock.calls[0][0]).toBe(getFilterEndpoint(filter));
// Have to do this because no jest matcher for JS Set
expect(Array.from(mock.mock.calls[0][1].data.subfilters)).toEqual([
'ie_pre_9',
'ie9',
'safari_pre_6',
'ie',
'safari',
'firefox',
]);

// Toggle filter off
await userEvent.click(
screen.getByRole('checkbox', {name: 'Internet Explorer (Deprecated) Version 11'})
);
expect(Array.from(mock.mock.calls[1][1].data.subfilters)).toEqual([
'ie_pre_9',
'ie9',
'safari_pre_6',
'ie11',
]);

mock.mockReset();

// Click ie9 and < ie9
await userEvent.click(
screen.getByRole('checkbox', {name: 'Internet Explorer (Deprecated) Version 9'})
);
await userEvent.click(
screen.getByRole('checkbox', {
name: 'Internet Explorer (Deprecated) Version 8 and lower',
})
await screen.findByRole('checkbox', {name: 'Firefox Version 66 and lower'})
);

expect(Array.from(mock.mock.calls[1][1].data.subfilters)).toEqual([
'safari_pre_6',
'ie11',
]);
expect(Array.from(mock.mock.calls[1][1].data.subfilters)).toEqual(['ie', 'safari']);
});

it('can toggle all/none for legacy browser', async function () {
Expand All @@ -180,15 +160,14 @@ describe('ProjectFilters', function () {
await userEvent.click(await screen.findByRole('button', {name: 'All'}));
expect(mock.mock.calls[0][0]).toBe(getFilterEndpoint(filter));
expect(Array.from(mock.mock.calls[0][1].data.subfilters)).toEqual([
'safari_pre_6',
'android_pre_4',
'edge_pre_79',
'ie_pre_9',
'ie9',
'ie10',
'ie11',
'opera_pre_15',
'opera_mini_pre_8',
'chrome',
'safari',
'firefox',
'android',
'edge',
'ie',
'opera',
'opera_mini',
]);

await userEvent.click(screen.getByRole('button', {name: 'None'}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ type RowProps = {
data: {
active: string[] | boolean;
};
hasLegacyBrowserUpdate: boolean;
onToggle: (
data: RowProps['data'],
filters: RowState['subfilters'],
Expand All @@ -211,8 +210,7 @@ class LegacyBrowserFilterRow extends Component<RowProps, RowState> {
if (props.data.active === true) {
initialSubfilters = new Set(
Object.keys(LEGACY_BROWSER_SUBFILTERS).filter(
key =>
LEGACY_BROWSER_SUBFILTERS[key].legacy === !this.props.hasLegacyBrowserUpdate
key => !LEGACY_BROWSER_SUBFILTERS[key].legacy
)
);
} else if (props.data.active === false) {
Expand All @@ -234,8 +232,7 @@ class LegacyBrowserFilterRow extends Component<RowProps, RowState> {
if (subfilter === true) {
subfilters = new Set(
Object.keys(LEGACY_BROWSER_SUBFILTERS).filter(
key =>
LEGACY_BROWSER_SUBFILTERS[key].legacy === !this.props.hasLegacyBrowserUpdate
key => !LEGACY_BROWSER_SUBFILTERS[key].legacy
)
);
} else if (subfilter === false) {
Expand Down Expand Up @@ -293,13 +290,10 @@ class LegacyBrowserFilterRow extends Component<RowProps, RowState> {
<FilterGrid>
{Object.keys(LEGACY_BROWSER_SUBFILTERS)
.filter(key => {
if (this.props.hasLegacyBrowserUpdate) {
if (!LEGACY_BROWSER_SUBFILTERS[key].legacy) {
return true;
}
return this.state.subfilters.has(key);
if (!LEGACY_BROWSER_SUBFILTERS[key].legacy) {
return true;
}
return LEGACY_BROWSER_SUBFILTERS[key].legacy;
return this.state.subfilters.has(key);
})
.map(key => {
const subfilter = LEGACY_BROWSER_SUBFILTERS[key];
Expand Down Expand Up @@ -405,9 +399,6 @@ type Filter = {
export function ProjectFiltersSettings({project, params, features}: Props) {
const organization = useOrganization();
const {projectId: projectSlug} = params;

const hasLegacyBrowserUpdate = organization.features.includes('legacy-browser-update');

const projectEndpoint = `/projects/${organization.slug}/${projectSlug}/`;
const filtersEndpoint = `${projectEndpoint}filters/`;

Expand Down Expand Up @@ -511,7 +502,6 @@ export function ProjectFiltersSettings({project, params, features}: Props) {
onToggle={(_data, subfilters, event) =>
handleLegacyChange({onChange, onBlur, event, subfilters})
}
hasLegacyBrowserUpdate={hasLegacyBrowserUpdate}
/>
)}
</FormField>
Expand Down
Loading