Skip to content

Commit 8a11f9e

Browse files
committed
revert(webapp): drop impersonation guard from /admin Delete
1 parent 5c98cbf commit 8a11f9e

1 file changed

Lines changed: 7 additions & 32 deletions

File tree

apps/webapp/app/routes/admin._index.tsx

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import {
2020
TableHeaderCell,
2121
TableRow,
2222
} from "~/components/primitives/Table";
23-
import { SimpleTooltip } from "~/components/primitives/Tooltip";
24-
import { useIsImpersonating } from "~/hooks/useOrganizations";
2523
import { useUser } from "~/hooks/useUser";
2624
import { adminGetUsers, redirectWithImpersonation } from "~/models/admin.server";
2725
import { deleteUser as deleteUserOnPlatform } from "~/services/platform.v3.server";
@@ -68,13 +66,6 @@ export async function action({ request }: ActionFunctionArgs) {
6866
return redirect("/");
6967
}
7068

71-
if (admin.isImpersonating) {
72-
return typedjson(
73-
{ error: "Stop impersonating before deleting users." },
74-
{ status: 400 }
75-
);
76-
}
77-
7869
const targetId = deleteAttempt.data.id;
7970

8071
if (targetId === admin.id) {
@@ -111,7 +102,6 @@ export async function action({ request }: ActionFunctionArgs) {
111102

112103
export default function AdminDashboardRoute() {
113104
const currentUser = useUser();
114-
const isImpersonating = useIsImpersonating();
115105
const { users, filters, page, pageCount, justDeleted } = useTypedLoaderData<typeof loader>();
116106
const actionData = useTypedActionData<typeof action>();
117107
const actionError =
@@ -237,28 +227,13 @@ export default function AdminDashboardRoute() {
237227
</Button>
238228
</Form>
239229
{!isSelf && !user.admin && (
240-
isImpersonating ? (
241-
<SimpleTooltip
242-
button={
243-
// Wrap in a span so hover events still fire
244-
// when the underlying button is disabled.
245-
<span tabIndex={0}>
246-
<Button type="button" variant="danger/small" disabled>
247-
Delete
248-
</Button>
249-
</span>
250-
}
251-
content="Stop impersonating to delete users"
252-
/>
253-
) : (
254-
<Button
255-
type="button"
256-
variant="danger/small"
257-
onClick={() => openDeleteDialog({ id: user.id, email: user.email })}
258-
>
259-
Delete
260-
</Button>
261-
)
230+
<Button
231+
type="button"
232+
variant="danger/small"
233+
onClick={() => openDeleteDialog({ id: user.id, email: user.email })}
234+
>
235+
Delete
236+
</Button>
262237
)}
263238
</div>
264239
</TableCell>

0 commit comments

Comments
 (0)