Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions apps/frontend/src/pages/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
{{
formatMessage(messages.discordRoleBannerBody, {
roles: eligibleDiscordRolesLabel,
count: eligibleDiscordRoles.length,
})
}}
</div>
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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: () => {
Expand All @@ -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(() =>
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Loading