File tree 3 files changed +12
-9
lines changed
pages/ManagementSettingsPage 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { API } from "api/api";
3
3
import type {
4
4
AuthorizationResponse ,
5
5
CreateOrganizationRequest ,
6
- Organization ,
7
6
UpdateOrganizationRequest ,
8
7
} from "api/typesGenerated" ;
9
8
import { meKey } from "./users" ;
@@ -169,9 +168,9 @@ export const organizationPermissions = (organizationId: string | undefined) => {
169
168
* If organizations are undefined, return a disabled query.
170
169
*/
171
170
export const organizationsPermissions = (
172
- organizations : Organization [ ] | undefined ,
171
+ organizationIds : string [ ] | undefined ,
173
172
) => {
174
- if ( ! organizations ) {
173
+ if ( ! organizationIds ) {
175
174
return { enabled : false } ;
176
175
}
177
176
@@ -215,10 +214,10 @@ export const organizationsPermissions = (
215
214
216
215
// The endpoint takes a flat array, so to avoid collisions prepend each
217
216
// check with the org ID (the key can be anything we want).
218
- const prefixedChecks = organizations
219
- . map ( ( org ) =>
220
- Object . entries ( checks ( org . id ) ) . map ( ( [ key , val ] ) => [
221
- `${ org . id } .${ key } ` ,
217
+ const prefixedChecks = organizationIds
218
+ . map ( ( orgId ) =>
219
+ Object . entries ( checks ( orgId ) ) . map ( ( [ key , val ] ) => [
220
+ `${ orgId } .${ key } ` ,
222
221
val ,
223
222
] ) ,
224
223
)
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ const OrganizationSettingsPage: FC = () => {
35
35
organizations && organizationName
36
36
? getOrganizationByName ( organizations , organizationName )
37
37
: undefined ;
38
- const permissionsQuery = useQuery ( organizationsPermissions ( organizations ) ) ;
38
+ const permissionsQuery = useQuery (
39
+ organizationsPermissions ( organizations ?. map ( ( o ) => o . id ) ) ,
40
+ ) ;
39
41
40
42
const permissions = permissionsQuery . data ;
41
43
if ( ! organizations || ! permissions ) {
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ export const Sidebar: FC = () => {
25
25
organization ?: string ;
26
26
} ;
27
27
28
- const orgPermissionsQuery = useQuery ( organizationsPermissions ( organizations ) ) ;
28
+ const orgPermissionsQuery = useQuery (
29
+ organizationsPermissions ( organizations ?. map ( ( o ) => o . id ) ) ,
30
+ ) ;
29
31
30
32
// Sometimes a user can read an organization but cannot actually do anything
31
33
// with it. For now, these are filtered out so you only see organizations you
You can’t perform that action at this time.
0 commit comments