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

Commita9a9cfa

Browse files
committed
gen + lint
1 parentc267137 commita9a9cfa

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

‎coderd/database/queries.sql.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/idpsync/organization.go

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,23 @@ func (s AGPLIDPSync) SyncOrganizations(ctx context.Context, tx database.Store, u
111111
returnorg.ID
112112
})
113113

114-
expectedOrganizations,err:=tx.GetOrganizations(ctx, database.GetOrganizationsParams{
115-
IDs:expectedOrgIDs,
116-
// Do not include deleted organizations
117-
Deleted:false,
118-
})
119-
iferr!=nil {
120-
returnxerrors.Errorf("failed to get expected organizations: %w",err)
114+
// finalExpected is the final set of org ids the user is expected to be in.
115+
// Deleted orgs are omitted from this set.
116+
finalExpected:=expectedOrgIDs
117+
iflen(expectedOrgIDs)>0 {
118+
expectedOrganizations,err:=tx.GetOrganizations(ctx, database.GetOrganizationsParams{
119+
IDs:expectedOrgIDs,
120+
// Do not include deleted organizations
121+
Deleted:false,
122+
})
123+
iferr!=nil {
124+
returnxerrors.Errorf("failed to get expected organizations: %w",err)
125+
}
126+
finalExpected=db2sdk.List(expectedOrganizations,func(org database.Organization) uuid.UUID {
127+
returnorg.ID
128+
})
121129
}
122130

123-
finalExpected:=db2sdk.List(expectedOrganizations,func(org database.Organization) uuid.UUID {
124-
returnorg.ID
125-
})
126-
127131
// Find the difference in the expected and the existing orgs, and
128132
// correct the set of orgs the user is a member of.
129133
add,remove:=slice.SymmetricDifference(existingOrgIDs,finalExpected)
@@ -142,7 +146,7 @@ func (s AGPLIDPSync) SyncOrganizations(ctx context.Context, tx database.Store, u
142146
})
143147
iferr!=nil {
144148
ifxerrors.Is(err,sql.ErrNoRows) {
145-
// This should not happen because we check the orgexistance
149+
// This should not happen because we check the orgexistence
146150
// beforehand.
147151
notExists=append(notExists,orgID)
148152
continue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp