Skip to content

Commit 2662a29

Browse files
malwilleyandrewshie-sentry
authored andcommitted
fix(issue-views): Lock down issue view title if not owner (#89824)
1 parent 7906e9e commit 2662a29

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

static/app/views/issueList/issueViews/issueViewSaveButton.spec.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ describe('IssueViewSaveButton', function () {
228228
await screen.findByTestId('save-button-unsaved');
229229

230230
await userEvent.click(screen.getByRole('button', {name: 'More save options'}));
231-
await userEvent.click(
232-
screen.getByRole('menuitemradio', {name: 'Discard unsaved changes'})
233-
);
231+
await userEvent.click(screen.getByRole('menuitemradio', {name: 'Reset'}));
234232

235233
// Discarding unsaved changes should reset URL query params
236234
await waitFor(() => {

static/app/views/issueList/issueViews/issueViewSaveButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ function SegmentedIssueViewSaveButton({
7474
items={[
7575
{
7676
key: 'reset',
77-
label: t('Discard unsaved changes'),
77+
label: t('Reset'),
78+
disabled: !hasUnsavedChanges,
7879
onAction: () => {
7980
trackAnalytics('issue_views.reset.clicked', {organization});
8081
discardUnsavedChanges();

static/app/views/issueList/issueViews/useSelectedGroupSeachView.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export function useSelectedGroupSearchView() {
2424
orgSlug: organization.slug,
2525
})
2626
);
27-
const matchingView = queryFromStarredViews?.find(v => v.id === viewId);
27+
const matchingView = queryFromStarredViews
28+
// XXX (malwilley): Issue views without the nav require at least one issue view,
29+
// so they respond with "fake" issue views that do not have an ID.
30+
// We should remove this from the backend and here once we remove the tab-based views.
31+
?.filter(view => defined(view.id))
32+
?.find(v => v.id === viewId);
2833

2934
return useFetchGroupSearchView(
3035
{

static/app/views/issueList/leftNavViewsHeader.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ type LeftNavViewsHeaderProps = {
3030
function PageTitle() {
3131
const organization = useOrganization();
3232
const {data: groupSearchView} = useSelectedGroupSearchView();
33+
const user = useUser();
3334
const hasIssueViewSharing = organization.features.includes('issue-view-sharing');
3435

35-
if (hasIssueViewSharing && groupSearchView) {
36+
if (
37+
hasIssueViewSharing &&
38+
groupSearchView &&
39+
canEditIssueView({groupSearchView, user})
40+
) {
3641
return <EditableIssueViewHeader view={groupSearchView} />;
3742
}
3843

0 commit comments

Comments
 (0)