Add Discord admin webhook notifications

This commit is contained in:
Jared Schoeny
2025-11-07 17:50:20 -10:00
parent 39bda37d11
commit c7a174fea0
8 changed files with 145 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ import { createClient } from '@/utils/supabase/client'
import { type User } from '@supabase/supabase-js'
import { useRouter } from 'next/navigation'
import { FiCheck, FiX, FiCopy } from 'react-icons/fi'
import { setupProfile } from '@/app/account/actions'
type UsernameState =
| { status: 'idle'; message: string }
@@ -114,13 +115,12 @@ export default function AccountSetupForm({ user }: { user: User }) {
try {
setSubmitting(true)
const { error } = await supabase.from('profiles').upsert({
id: user.id,
username,
updated_at: new Date().toISOString(),
})
const result = await setupProfile(username)
if (error) throw error
if (!result || !result.ok) {
setUsernameState({ status: 'invalid', message: result?.error || 'There was an error saving. Please try again.' })
return
}
// Refresh SSR boundary so the page re-renders into the update form state
router.refresh()

View File

@@ -410,7 +410,7 @@ export default function HackSubmitForm({ dummy = false }: HackSubmitFormProps) {
if (patchFile) {
await fetch(presigned.presignedUrl, { method: 'PUT', body: patchFile, headers: { 'Content-Type': 'application/octet-stream' } });
const finalized = await confirmPatchUpload({ slug: prepared.slug, objectKey: presigned.objectKey!, version });
const finalized = await confirmPatchUpload({ slug: prepared.slug, objectKey: presigned.objectKey!, version, firstUpload: true });
if (!finalized.ok) throw new Error(finalized.error || 'Failed to finalize');
try {
if (draftKey) {