diff --git a/src/app/account/actions.ts b/src/app/account/actions.ts index 6931281..ba5089e 100644 --- a/src/app/account/actions.ts +++ b/src/app/account/actions.ts @@ -55,7 +55,7 @@ export async function setupProfile(username: string): Promise { await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_ADMIN_URL, [ { title: 'New Profile Setup', - description: `A new user (\`${user.id}\`) has setup their profile with the username: \`@${username}\``, + description: `A new user (\`${user.id}\`) has created an account with the username: \`@${username}\``, color: 0x40f56a, footer: { text: 'This message brought to you by Hackdex' diff --git a/src/app/hack/actions.ts b/src/app/hack/actions.ts index 68adcf8..dc75a76 100644 --- a/src/app/hack/actions.ts +++ b/src/app/hack/actions.ts @@ -319,7 +319,7 @@ export async function approveHack(slug: string) { if (updateErr) return { ok: false, error: updateErr.message } as const; - if (process.env.DISCORD_WEBHOOK_ADMIN_URL) { + if (process.env.DISCORD_WEBHOOK_HACKDEX_HACKS_URL) { const { data: profile } = await supabase.from('profiles').select('*').eq('id', hack.created_by).single(); const displayName = profile?.username ? `@${profile.username}` : user.id; const embed: APIEmbed = { @@ -331,7 +331,7 @@ export async function approveHack(slug: string) { text: `This message brought to you by Hackdex` } } - await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_ADMIN_URL, [ + await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_HACKDEX_HACKS_URL, [ embed, ]); } diff --git a/src/app/signup/actions.ts b/src/app/signup/actions.ts index 4fbd9aa..c9b0c4f 100644 --- a/src/app/signup/actions.ts +++ b/src/app/signup/actions.ts @@ -72,26 +72,12 @@ export async function signup(state: AuthActionState, payload: FormData) { return { error: passwordError }; } - const { data: signUpResult, error } = await supabase.auth.signUp(data) + const { error } = await supabase.auth.signUp(data) if (error) { return { error: getErrorMessage(error) }; } - const userId = signUpResult.user?.id || null - if (process.env.DISCORD_WEBHOOK_ADMIN_URL) { - await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_ADMIN_URL, [ - { - title: 'New User Signup', - description: `A new user (\`${userId}\`) has signed up.`, - color: 0x40f56a, - footer: { - text: 'A notification will be sent when this user has created their profile' - } - }, - ]); - } - revalidatePath('/', 'layout'); const redirectTo = (payload.get('redirectTo') as string | null) || null const isValidInternalPath = redirectTo && redirectTo.startsWith('/') && !redirectTo.startsWith('//') diff --git a/src/app/submit/actions.ts b/src/app/submit/actions.ts index 6f28f4a..dca5d89 100644 --- a/src/app/submit/actions.ts +++ b/src/app/submit/actions.ts @@ -110,7 +110,7 @@ export async function prepareSubmission(formData: FormData) { } } - if (process.env.DISCORD_WEBHOOK_ADMIN_URL) { + if (process.env.DISCORD_WEBHOOK_ADMIN_HACKS_URL) { const { data: profile } = await supabase.from('profiles').select('*').eq('id', user.id).single(); const displayName = profile?.username ? `@${profile.username}` : user.id; @@ -123,7 +123,7 @@ export async function prepareSubmission(formData: FormData) { text: `This message brought to you by Hackdex` } } - await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_ADMIN_URL, [ + await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_ADMIN_HACKS_URL, [ embed, ]); } @@ -260,9 +260,8 @@ export async function confirmPatchUpload(args: { slug: string; objectKey: string .eq("slug", args.slug); if (uErr) return { ok: false, error: uErr.message } as const; - if (process.env.DISCORD_WEBHOOK_ADMIN_URL) { + if (process.env.DISCORD_WEBHOOK_ADMIN_HACKS_URL) { const { data: profile } = await supabase.from('profiles').select('*').eq('id', hack.created_by).single(); - const displayName = profile?.username ? `@${profile.username}` : hack.created_by; const uploadedByDifferentUser = hack.created_by !== user.id; @@ -284,7 +283,11 @@ export async function confirmPatchUpload(args: { slug: string; objectKey: string } } - await sendDiscordMessageEmbed(process.env.DISCORD_WEBHOOK_ADMIN_URL, [ + const webhookUrl = args.firstUpload ? + process.env.DISCORD_WEBHOOK_ADMIN_HACKS_URL : + process.env.DISCORD_WEBHOOK_HACKDEX_HACKS_URL || process.env.DISCORD_WEBHOOK_ADMIN_HACKS_URL; + + await sendDiscordMessageEmbed(webhookUrl, [ embed, ]); }