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
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit985b877

Browse files
author
Faris Huskovic
committed
suggested changes
1 parent89f848f commit985b877

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

‎internal/cmd/ceapi.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ func findImg(ctx context.Context, client *coder.Client, email, imgName, orgName
9191
returnnil,xerrors.New("image name unset")
9292
}
9393

94-
imgs,err:=getImgs(ctx,client,email,orgName)
94+
imgs,err:=getImgs(ctx,
95+
getImgsConf{
96+
client:client,
97+
email:email,
98+
orgName:orgName,
99+
},
100+
)
95101
iferr!=nil {
96102
returnnil,err
97103
}
@@ -127,36 +133,42 @@ func findImg(ctx context.Context, client *coder.Client, email, imgName, orgName
127133
)
128134
}
129135

130-
funcgetImgs(ctx context.Context,client*coder.Client,email,orgNamestring) ([]coder.Image,error) {
131-
u,err:=client.UserByEmail(ctx,email)
136+
typegetImgsConfstruct {
137+
client*coder.Client
138+
emailstring
139+
orgNamestring
140+
}
141+
142+
funcgetImgs(ctx context.Context,confgetImgsConf) ([]coder.Image,error) {
143+
u,err:=conf.client.UserByEmail(ctx,conf.email)
132144
iferr!=nil {
133145
returnnil,err
134146
}
135147

136-
orgs,err:=client.Organizations(ctx)
148+
orgs,err:=conf.client.Organizations(ctx)
137149
iferr!=nil {
138150
returnnil,err
139151
}
140152

141153
orgs=lookupUserOrgs(u,orgs)
142154

143155
for_,org:=rangeorgs {
144-
imgs,err:=client.GetOrganizationImages(ctx,org.ID)
156+
imgs,err:=conf.client.GetOrganizationImages(ctx,org.ID)
145157
iferr!=nil {
146158
returnnil,err
147159
}
148160
// If orgName is set we know the user is a multi-org member
149161
// so we should only return the imported images that beong to the org they specified.
150-
iforgName!=""&&orgName==org.Name {
162+
ifconf.orgName!=""&&conf.orgName==org.Name {
151163
returnimgs,nil
152164
}
153165

154-
iforgName=="" {
166+
ifconf.orgName=="" {
155167
// if orgName is unset we know the user is only part of one org.
156168
returnimgs,nil
157169
}
158170
}
159-
returnnil,xerrors.Errorf("org name %q not found",orgName)
171+
returnnil,xerrors.Errorf("org name %q not found",conf.orgName)
160172
}
161173

162174
funcisMultiOrgMember(ctx context.Context,emailstring) (*bool,error) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp