fix(feedback): persist guest feedback settings, unshadow the guest route (#1030) (#1032)

Enabling Guest Feedback on an event could silently do nothing.

1. `updateEventFeedbackSettings` spread the request body straight into the
   knex UPDATE. The admin event form posts its whole client-side state,
   including three keys that were never columns on event_feedback_settings
   (`enable_rate_limiting`, `rate_limit_window_minutes`,
   `rate_limit_max_requests`), so the write threw and the route answered 500.
   Writable columns are now whitelisted; identity columns and timestamps stay
   server-managed.

2. EventDetailsPage swallowed that 500 in a bare `catch {}` ("Error already
   handled by mutation" — it is a different request), so the admin was left
   looking at "Event updated successfully" while the toggle never persisted.
   The error is surfaced now and the settings query is invalidated on success.

3. gallery.js declared a duplicate `GET /:slug/feedback-settings`. server.js
   mounts galleryRoutes before galleryFeedback, so it shadowed the real
   handler and dropped the per-guest caps (#655) from the guest payload — the
   gallery could never render the favorite/like limits or their counters.

Timestamps are written as ISO strings so they round-trip on both engines.

Claude-Session: https://claude.ai/code/session_0168gubtwYYacJv8weAjy8DM

Co-authored-by: Paul Nothaft <[email protected]>
This commit is contained in:
Paul Nothaft
2026-08-13 18:51:16 +02:00
committed by GitHub
co-authored by Paul Nothaft
parent 8b6cd3c74f
commit de459c701f
4 changed files with 219 additions and 32 deletions
+10 -3
View File
@@ -524,11 +524,18 @@ export const EventDetailsPage: React.FC = () => {
// Update event details
updateMutation.mutate(updateData);
// Update feedback settings separately
// Update feedback settings separately. This is its own request, so a
// failure here is NOT covered by updateMutation's onError (#1030) — the
// old bare catch left the admin looking at "Event updated successfully"
// while the Guest Feedback toggle silently never persisted.
try {
await feedbackService.updateEventFeedbackSettings(id!, feedbackSettings);
} catch {
// Error already handled by mutation
queryClient.invalidateQueries({ queryKey: ['admin-event-feedback-settings', id] });
} catch (error: any) {
toast.error(
error?.response?.data?.error
|| t('feedback.settingsUpdateError', 'Failed to update settings')
);
}
};