Skip to content

Commit

Permalink
permissionalert: deprecate old permission alert
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Feb 8, 2025
1 parent bff8679 commit 49e0dc9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
41 changes: 41 additions & 0 deletions static/app/views/settings/project/permissionAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Access from 'sentry/components/acl/access';
import type {AlertProps} from 'sentry/components/alert';
import {Alert} from 'sentry/components/alert';
import {t} from 'sentry/locale';
import type {Scope} from 'sentry/types/core';
import type {Team} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';

interface PermissionAlertProps extends Omit<AlertProps, 'type'> {
access?: Scope[];
project?: Project;
team?: Team;
}

export const permissionAlertText = t(
'These settings can only be edited by users with the organization-level owner, manager, or team-level admin roles.'
);

/**
* @deprecated Use `ProjectPermissionAlert` instead.
*/
function PermissionAlert({
access = ['project:write'],
project,
team,
...props
}: PermissionAlertProps) {
return (
<Access access={access} project={project} team={team}>
{({hasAccess}) =>
!hasAccess && (
<Alert data-test-id="project-permission-alert" type="warning" {...props}>
{permissionAlertText}
</Alert>
)
}
</Access>
);
}

export default PermissionAlert;
2 changes: 0 additions & 2 deletions static/app/views/settings/project/projectPermissionAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ export function ProjectPermissionAlert({
</Access>
);
}

export default ProjectPermissionAlert;

0 comments on commit 49e0dc9

Please sign in to comment.