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

Use oauth_github table for sync_admins#12964

Open
carols10cents wants to merge 5 commits intorust-lang:mainfrom
carols10cents:admin-commands
Open

Use oauth_github table for sync_admins#12964
carols10cents wants to merge 5 commits intorust-lang:mainfrom
carols10cents:admin-commands

Conversation

@carols10cents
Copy link
Member

This is a tiny, low-risk way to start using theoauth_github table as the source of truth for GitHub IDs in the background process that syncs from the team repo to set the admin flag on users.

I volunteer as tribute to be removed (and then readded 🤞🏻 ) as an admin in the team repo to test this out 😁

@carols10cents
Copy link
MemberAuthor

@Turbo87 Ok, I've substantially rewritten this change. Instead of doing a bunch of complex queries, this is now doing one SELECT for all the information this job needs from the database, then filtering through that and collecting user IDs for the various situations, and sending UPDATEs using only user IDs.

Also nevermind my comment before about needing to switch the output from github ID to user ID, because all the information is in theVec<UserData>, we can filter those instances by user ID but display the github ID from the instance.

The only case that can't use user IDs is for github IDs in the team repo that have never logged into crates.io and therefore don't have crates.io users we can find.

Because some of these are going to be changing to crates.io user IDs,but some will need to remain GitHub IDs. Hopefully having `github` inthe variable name will make it clearer.
Rather than switching back and forth between github IDs and user IDs anddoing lots of queries.Use oauth_github.account_id rather than users.gh_id to prepare foreventual deprecation of that field to allow for multiple oauthproviders.Continue to use users.gh_login anticipating that that field will becomea crates.io username independent of any login.This does one query for all the user info we might need for currentadmins and new admins, then is able to issue UPDATEs to only the userstable using crates.io user IDs.The only case that must still use github IDs is when there's a user inthe teams repo that has never logged in to crates.io.
For a world where admins can remove their GitHub association someday, tomake sure we don't miss removing them if they also leave the crates.ioadmin team.Fails as of this commit; will be fixed in the next one.
To future-proof sync admins for a time when it will be possible toremove association between crates.io account and GitHub account.When querying for current admins, use a LEFT JOIN and makeoauth_github::account_id optional to account for the case of a userremoving their GitHub account from their crates.io account, leaving thecrates.io admin team, and then sync admins running. Because they werepreviously an admin and now they're not, they should still get the emailnotification of the change in admins, and they should be removed as anadmin in crates.io.
@carols10cents
Copy link
MemberAuthor

@Turbo87 ready for rereview!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@Turbo87Turbo87Turbo87 left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@carols10cents@Turbo87@rustbot

Comments


[8]ページ先頭

©2009-2026 Movatter.jp