feat: use discord_id from discord sso for role grant#6326
Open
IMB11 wants to merge 2 commits into
Open
Conversation
Member
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
Member
Frontend previewsLast deployed commit is 80cc13d52692e5b1bbd17db31e89d2a3ad78d84f
|
aecsocket
requested changes
Jun 7, 2026
Comment on lines
+1395
to
+1404
| #[utoipa::path( | ||
| post, | ||
| operation_id = "discordCommunityLink", | ||
| responses( | ||
| (status = 200, description = "Discord community bot handoff URL", body = DiscordCommunityLinkResponse), | ||
| (status = 400, description = "Discord provider not linked"), | ||
| (status = 401, description = "Unauthorized") | ||
| ), | ||
| security(("bearer_auth" = ["SESSION_ACCESS"])) | ||
| )] |
Contributor
There was a problem hiding this comment.
Suggested change
| #[utoipa::path( | |
| post, | |
| operation_id = "discordCommunityLink", | |
| responses( | |
| (status = 200, description = "Discord community bot handoff URL", body = DiscordCommunityLinkResponse), | |
| (status = 400, description = "Discord provider not linked"), | |
| (status = 401, description = "Unauthorized") | |
| ), | |
| security(("bearer_auth" = ["SESSION_ACCESS"])) | |
| )] | |
| #[utoipa::path( | |
| operation_id = "discordCommunityLink", | |
| responses( | |
| (status = 200, description = "Discord community bot handoff URL", body = DiscordCommunityLinkResponse), | |
| (status = 400, description = "Discord provider not linked"), | |
| (status = 401, description = "Unauthorized") | |
| ), | |
| security(("bearer_auth" = ["SESSION_ACCESS"])) | |
| )] |
Comment on lines
+1430
to
+1432
| let Some(discord_id) = db_user.discord_id else { | ||
| return Err(ApiError::Request(eyre!("discord_not_linked"))); | ||
| }; |
Contributor
There was a problem hiding this comment.
Suggested change
| let Some(discord_id) = db_user.discord_id else { | |
| return Err(ApiError::Request(eyre!("discord_not_linked"))); | |
| }; | |
| let Some(discord_id) = db_user.discord_id else { | |
| return Err(ApiError::Request(eyre!("discord account is not linked"))); | |
| }; |
unless you're matching on this exact string on the frontend to show some kind of unique message? in which case, make a new ApiError variant to make this explicit, or match on the new human-readable message
| .await | ||
| .wrap_err("failed to begin Discord role email campaign transaction")?; | ||
|
|
||
| let lock_acquired = sqlx::query_scalar::<_, bool>( |
| return Ok(()); | ||
| } | ||
|
|
||
| let user_ids = sqlx::query_scalar::<_, i64>( |
Signed-off-by: Calum H. <calum@modrinth.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.