Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite4f5bf7

Browse files
committed
Pass in ids instead of entire orgs
1 parent83bf388 commite4f5bf7

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

‎site/src/api/queries/organizations.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { API } from "api/api";
33
importtype{
44
AuthorizationResponse,
55
CreateOrganizationRequest,
6-
Organization,
76
UpdateOrganizationRequest,
87
}from"api/typesGenerated";
98
import{meKey}from"./users";
@@ -169,9 +168,9 @@ export const organizationPermissions = (organizationId: string | undefined) => {
169168
* If organizations are undefined, return a disabled query.
170169
*/
171170
exportconstorganizationsPermissions=(
172-
organizations:Organization[]|undefined,
171+
organizationIds:string[]|undefined,
173172
)=>{
174-
if(!organizations){
173+
if(!organizationIds){
175174
return{enabled:false};
176175
}
177176

@@ -215,10 +214,10 @@ export const organizationsPermissions = (
215214

216215
// The endpoint takes a flat array, so to avoid collisions prepend each
217216
// check with the org ID (the key can be anything we want).
218-
constprefixedChecks=organizations
219-
.map((org)=>
220-
Object.entries(checks(org.id)).map(([key,val])=>[
221-
`${org.id}.${key}`,
217+
constprefixedChecks=organizationIds
218+
.map((orgId)=>
219+
Object.entries(checks(orgId)).map(([key,val])=>[
220+
`${orgId}.${key}`,
222221
val,
223222
]),
224223
)

‎site/src/pages/ManagementSettingsPage/OrganizationSettingsPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const OrganizationSettingsPage: FC = () => {
3535
organizations&&organizationName
3636
?getOrganizationByName(organizations,organizationName)
3737
:undefined;
38-
constpermissionsQuery=useQuery(organizationsPermissions(organizations));
38+
constpermissionsQuery=useQuery(
39+
organizationsPermissions(organizations?.map((o)=>o.id)),
40+
);
3941

4042
constpermissions=permissionsQuery.data;
4143
if(!organizations||!permissions){

‎site/src/pages/ManagementSettingsPage/Sidebar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export const Sidebar: FC = () => {
2525
organization?:string;
2626
};
2727

28-
constorgPermissionsQuery=useQuery(organizationsPermissions(organizations));
28+
constorgPermissionsQuery=useQuery(
29+
organizationsPermissions(organizations?.map((o)=>o.id)),
30+
);
2931

3032
// Sometimes a user can read an organization but cannot actually do anything
3133
// with it. For now, these are filtered out so you only see organizations you

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp