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

Commitd65a8da

Browse files
committed
chore: add github.com user id association
This will eventually be used to show an indicator in the UIto star the repository if you've been using Coder for a whileand have not starred the repo.If you have, we'll never show a thing!
1 parent56dfc64 commitd65a8da

File tree

15 files changed

+189
-30
lines changed

15 files changed

+189
-30
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,6 +3270,23 @@ func (q *querier) UpdateUserDeletedByID(ctx context.Context, id uuid.UUID) error
32703270
returndeleteQ(q.log,q.auth,q.db.GetUserByID,q.db.UpdateUserDeletedByID)(ctx,id)
32713271
}
32723272

3273+
func (q*querier)UpdateUserGithubComUserID(ctx context.Context,arg database.UpdateUserGithubComUserIDParams)error {
3274+
user,err:=q.db.GetUserByID(ctx,arg.ID)
3275+
iferr!=nil {
3276+
returnerr
3277+
}
3278+
3279+
err=q.authorizeContext(ctx,policy.ActionUpdatePersonal,user)
3280+
iferr!=nil {
3281+
// Admins can update passwords for other users.
3282+
err=q.authorizeContext(ctx,policy.ActionUpdate,user)
3283+
iferr!=nil {
3284+
returnerr
3285+
}
3286+
}
3287+
returnq.db.UpdateUserGithubComUserID(ctx,arg)
3288+
}
3289+
32733290
func (q*querier)UpdateUserHashedPassword(ctx context.Context,arg database.UpdateUserHashedPasswordParams)error {
32743291
user,err:=q.db.GetUserByID(ctx,arg.ID)
32753292
iferr!=nil {

‎coderd/database/dbmem/dbmem.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8094,6 +8094,26 @@ func (q *FakeQuerier) UpdateUserDeletedByID(_ context.Context, id uuid.UUID) err
80948094
returnsql.ErrNoRows
80958095
}
80968096

8097+
func (q*FakeQuerier)UpdateUserGithubComUserID(ctx context.Context,arg database.UpdateUserGithubComUserIDParams)error {
8098+
err:=validateDatabaseType(arg)
8099+
iferr!=nil {
8100+
returnerr
8101+
}
8102+
8103+
q.mutex.Lock()
8104+
deferq.mutex.Unlock()
8105+
8106+
fori,user:=rangeq.users {
8107+
ifuser.ID!=arg.ID {
8108+
continue
8109+
}
8110+
user.GithubComUserID=arg.GithubComUserID
8111+
q.users[i]=user
8112+
returnnil
8113+
}
8114+
returnsql.ErrNoRows
8115+
}
8116+
80978117
func (q*FakeQuerier)UpdateUserHashedPassword(_ context.Context,arg database.UpdateUserHashedPasswordParams)error {
80988118
iferr:=validateDatabaseType(arg);err!=nil {
80998119
returnerr

‎coderd/database/dbmetrics/dbmetrics.go‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dbmock/dbmock.go‎

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dump.sql‎

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTERTABLE users DROP COLUMN github_com_user_id;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTERTABLE users ADD COLUMN github_com_user_idBIGINT;
2+
3+
COMMENT ON COLUMN users.github_com_user_id IS'The GitHub.com numerical user ID. At time of implementation, this is used to check if the user has starred the Coder repository.';

‎coderd/database/models.go‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/querier.go‎

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

‎coderd/database/queries.sql.go‎

Lines changed: 46 additions & 13 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp