feat(activities): pending-aware toast + unified pending gate

Rename willGoToPending → willLandInPending, drop the (now-redundant)
isEditMode predicate from the gate so create can reuse it. Toast
copy now confirms the destination explicitly:

  create + pending : "Submitted! Awaiting admin approval — your
                     draft is visible on your feed with a Pending
                     badge."
  edit + pending   : "Updated — awaiting re-approval. Hidden from
                     the public feed until reviewed."

Closes the surprise where a non-admin user under auto_approve=off
got a generic "Event submitted!" and then couldn't tell whether
their post had been accepted or was just waiting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-21 16:53:55 +02:00
commit 63fc7b3ab8

View file

@ -67,8 +67,12 @@ const emit = defineEmits<{
}>() }>()
const isEditMode = computed(() => Boolean(props.event?.id)) const isEditMode = computed(() => Boolean(props.event?.id))
const willGoToPending = computed( // True when the submission will land in `proposed` status: a non-admin
() => isEditMode.value && !props.isAdmin && !props.autoApprove // owner with the extension's auto_approve toggle off. Same gate for
// create and edit; the edit path also keys the in-form warning banner
// on this so the user sees the consequence before submitting.
const willLandInPending = computed(
() => !props.isAdmin && !props.autoApprove
) )
const { t } = useI18n() const { t } = useI18n()
@ -302,8 +306,8 @@ const onSubmit = form.handleSubmit(async (formValues) => {
} }
await props.onUpdateEvent(props.event.id, eventData) await props.onUpdateEvent(props.event.id, eventData)
toastService.success( toastService.success(
willGoToPending.value willLandInPending.value
? 'Event updated — pending re-approval' ? 'Updated — awaiting re-approval. Hidden from the public feed until reviewed.'
: 'Event updated!' : 'Event updated!'
) )
emit('event-updated') emit('event-updated')
@ -313,7 +317,11 @@ const onSubmit = form.handleSubmit(async (formValues) => {
return return
} }
await props.onCreateEvent(eventData) await props.onCreateEvent(eventData)
toastService.success('Event submitted!') toastService.success(
willLandInPending.value
? 'Submitted! Awaiting admin approval — your draft is visible on your feed with a Pending badge.'
: 'Event submitted!'
)
emit('event-created') emit('event-created')
} }
@ -363,7 +371,7 @@ const handleOpenChange = (open: boolean) => {
<ScrollArea class="max-h-[70vh] px-6 pb-6"> <ScrollArea class="max-h-[70vh] px-6 pb-6">
<form @submit="onSubmit" class="space-y-4"> <form @submit="onSubmit" class="space-y-4">
<Alert v-if="willGoToPending" variant="default" class="border-orange-500/40 bg-orange-500/5"> <Alert v-if="isEditMode && willLandInPending" variant="default" class="border-orange-500/40 bg-orange-500/5">
<AlertCircle class="h-4 w-4 text-orange-500" /> <AlertCircle class="h-4 w-4 text-orange-500" />
<AlertDescription> <AlertDescription>
Saving will resubmit for approval. The event will be removed Saving will resubmit for approval. The event will be removed