feat: use discord_id from discord sso for role grant (#6326)

* feat: properly use labrinth's linked discord accts sso for discord bot

* Update email for fixture user in SQL insert

Signed-off-by: Calum H. <calum@modrinth.com>

* fix: rev changes

* fix: copy on email

* fix: lint

* fix: rev

* fix: lint

---------

Signed-off-by: Calum H. <calum@modrinth.com>
This commit is contained in:
Calum H.
2026-06-09 17:33:07 +00:00
committed by GitHub
parent bc5a761312
commit 543d25e2d6
20 changed files with 726 additions and 59 deletions
@@ -153,6 +153,7 @@ pub enum LegacyNotificationBody {
amount: u64,
date_available: DateTime<Utc>,
},
DiscordRoleCreatorClub,
Custom {
key: String,
title: String,
@@ -242,6 +243,9 @@ impl LegacyNotification {
NotificationBody::PayoutAvailable { .. } => {
Some("payout_available".to_string())
}
NotificationBody::DiscordRoleCreatorClub => {
Some("discord_role_creator_club".to_string())
}
NotificationBody::Custom { .. } => Some("custom".to_string()),
NotificationBody::LegacyMarkdown {
notification_type, ..
@@ -350,6 +354,9 @@ impl LegacyNotification {
amount,
date_available,
},
NotificationBody::DiscordRoleCreatorClub => {
LegacyNotificationBody::DiscordRoleCreatorClub
}
NotificationBody::LegacyMarkdown {
notification_type,
name,
@@ -59,6 +59,7 @@ pub enum NotificationType {
ProjectStatusNeutral,
ProjectTransferred,
PayoutAvailable,
DiscordRoleCreatorClub,
Custom,
Unknown,
}
@@ -98,6 +99,9 @@ impl NotificationType {
NotificationType::Custom => "custom",
NotificationType::ProjectStatusNeutral => "project_status_neutral",
NotificationType::ProjectTransferred => "project_transferred",
NotificationType::DiscordRoleCreatorClub => {
"discord_role_creator_club"
}
NotificationType::Unknown => "unknown",
}
}
@@ -134,6 +138,9 @@ impl NotificationType {
}
"project_status_neutral" => NotificationType::ProjectStatusNeutral,
"project_transferred" => NotificationType::ProjectTransferred,
"discord_role_creator_club" => {
NotificationType::DiscordRoleCreatorClub
}
"custom" => NotificationType::Custom,
"unknown" => NotificationType::Unknown,
_ => NotificationType::Unknown,
@@ -259,6 +266,7 @@ pub enum NotificationBody {
date_available: DateTime<Utc>,
amount: u64,
},
DiscordRoleCreatorClub,
Custom {
key: String,
title: String,
@@ -347,6 +355,9 @@ impl NotificationBody {
NotificationBody::PayoutAvailable { .. } => {
NotificationType::PayoutAvailable
}
NotificationBody::DiscordRoleCreatorClub => {
NotificationType::DiscordRoleCreatorClub
}
NotificationBody::Custom { .. } => NotificationType::Custom,
NotificationBody::Unknown => NotificationType::Unknown,
}
@@ -619,6 +630,12 @@ impl From<DBNotification> for Notification {
"A payout is available!".to_string(),
"#".to_string(),
vec![],
),
NotificationBody::DiscordRoleCreatorClub => (
"Join the Creator Club".to_string(),
"Link your Discord account to claim your creator community role.".to_string(),
"/discord/link".to_string(),
vec![],
),
NotificationBody::ModerationMessageReceived { .. } => (
"New message in moderation thread".to_string(),