diff --git a/apps/frontend/src/pages/dashboard.vue b/apps/frontend/src/pages/dashboard.vue index 2a82c1ab89..03db7bedbd 100644 --- a/apps/frontend/src/pages/dashboard.vue +++ b/apps/frontend/src/pages/dashboard.vue @@ -61,6 +61,7 @@ {{ formatMessage(messages.discordRoleBannerBody, { roles: eligibleDiscordRolesLabel, + count: eligibleDiscordRoles.length, }) }} @@ -162,7 +163,7 @@ const messages = defineMessages({ discordRoleBannerBody: { id: 'dashboard.discord-roles.banner.body', defaultMessage: - "You're eligible for {roles}. Link your Discord account through Modrinth and we'll sync them automatically.", + "You're eligible for the {roles} creator {count, plural, one {role} other {roles}} on Discord. Link your Discord account through Modrinth and we'll sync {count, plural, one {it} other {them}} automatically.", }, discordRoleBannerCta: { id: 'dashboard.discord-roles.banner.cta', @@ -192,6 +193,10 @@ useSeoMeta({ const route = useNativeRoute() +const hasLinkedDiscordAccount = computed( + () => auth.value.user?.auth_providers?.includes('discord') === true, +) + const { data: projects } = useQuery({ queryKey: computed(() => ['dashboard-discord-role-eligibility', auth.value.user?.id, 'projects']), queryFn: () => { @@ -200,7 +205,7 @@ const { data: projects } = useQuery({ return client.labrinth.users_v2.getProjects(userId) }, - enabled: computed(() => !!auth.value.user?.id), + enabled: computed(() => !!auth.value.user?.id && !hasLinkedDiscordAccount.value), }) const totalProjectDownloads = computed(() => @@ -238,7 +243,10 @@ const hasDismissedDiscordRoleBanner = computed(() => dismissedDiscordRoleBannerUsers.value.includes(auth.value.user?.id ?? ''), ) const showDiscordRoleBanner = computed( - () => eligibleDiscordRoles.value.length > 0 && !hasDismissedDiscordRoleBanner.value, + () => + eligibleDiscordRoles.value.length > 0 && + !hasLinkedDiscordAccount.value && + !hasDismissedDiscordRoleBanner.value, ) function dismissDiscordRoleBanner() { diff --git a/apps/labrinth/migrations/20260609193000_update-discord-role-email-fallback.sql b/apps/labrinth/migrations/20260609193000_update-discord-role-email-fallback.sql new file mode 100644 index 0000000000..cdb1435696 --- /dev/null +++ b/apps/labrinth/migrations/20260609193000_update-discord-role-email-fallback.sql @@ -0,0 +1,18 @@ +UPDATE notifications_templates +SET plaintext_fallback = CONCAT( + 'Hey {user.name}!', + CHR(10), + CHR(10), + 'Your projects just passed 20,000 total downloads, nice!', + CHR(10), + CHR(10), + 'We want to invite you to Modrinth''s Creator Club, a space in our discord where you can chat with other creators, share feedback with us, and stay plugged in.', + CHR(10), + CHR(10), + 'To join just link your Discord account through Modrinth and we''ll grant access automatically!', + CHR(10), + CHR(10), + 'Join the Creator Club: {discord.link_url}' +) +WHERE channel = 'email' + AND notification_type = 'discord_role_creator_club';