8000 Two is now one · coder/coder@64631e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 64631e1

Browse files
committed
Two is now one
1 parent ddd2ea5 commit 64631e1

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

site/src/pages/ManagementSettingsPage/ManagementSettingsLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const canEditOrganization = (
2828
permissions: AuthorizationResponse | undefined,
2929
) => {
3030
return (
31-
permissions &&
31+
permissions !== undefined &&
3232
(permissions.editOrganization ||
3333
permissions.editMembers ||
3434
permissions.editGroups)

site/src/pages/ManagementSettingsPage/Sidebar.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@ export const Sidebar: FC = () => {
3838
permissions: orgPermissionsQuery.data?.[org.id],
3939
};
4040
})
41-
// TypeScript is not able to infer whether permissions are defined from the
42-
// canEditOrganization call, so although redundant this helps figure it out.
43-
.filter(
44-
(org): org is OrganizationWithPermissions =>
45-
org.permissions !== undefined,
46-
)
47-
.filter((org) => {
41+
// TypeScript is not able to infer whether permissions are defined on the
42+
// object even if we explicitly check org.permissions here, so add the `is`
43+
// here to help out (canEditOrganization does the actual check).
44+
.filter((org): org is OrganizationWithPermissions => {
4845
return canEditOrganization(org.permissions);
4946
});
5047

0 commit comments

Comments
 (0)
0