Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(client): send multiple_choice from the desktop poll form

jubnla8d6663dc779
diff --git a/client/src/components/Collab/CollabPolls.test.tsx b/client/src/components/Collab/CollabPolls.test.tsx
index 5d8275ebf..8a526ae82 100644
--- a/client/src/components/Collab/CollabPolls.test.tsx
+++ b/client/src/components/Collab/CollabPolls.test.tsx
@@ -30,7 +30,7 @@ const buildPoll = (overrides: Record<string, unknown> = {}) => ({
{ id: 1, text: 'Paris', label: 'Paris', voters: [] },
{ id: 2, text: 'Rome', label: 'Rome', voters: [] },
],
- multi_choice: false,
+ multiple_choice: false,
is_closed: false,
deadline: null,
created_by: 1,
diff --git a/client/src/components/Collab/CollabPolls.tsx b/client/src/components/Collab/CollabPolls.tsx
index 951424657..530f2b1ca 100644
--- a/client/src/components/Collab/CollabPolls.tsx
+++ b/client/src/components/Collab/CollabPolls.tsx
@@ -26,7 +26,7 @@ interface Poll {
id: number
question: string
options: PollOption[]
- multi_choice: boolean
+ multiple_choice: boolean
is_closed: boolean
deadline: string | null
created_by: number
@@ -59,7 +59,7 @@ function totalVotes(poll) {
// ── Create Poll Modal ────────────────────────────────────────────────────────
interface CreatePollModalProps {
onClose: () => void
- onCreate: (data: { question: string; options: string[]; multi_choice: boolean }) => Promise<void>
+ onCreate: (data: { question: string; options: string[]; multiple_choice: boolean }) => Promise<void>
t: (key: string) => string
}
@@ -80,7 +80,9 @@ function CreatePollModal({ onClose, onCreate, t }: CreatePollModalProps) {
if (!canSubmit) return
setSubmitting(true)
try {
- await onCreate({ question: question.trim(), options: options.filter(o => o.trim()), multi_choice: multiChoice })
+ // `multiple_choice` is the field the server reads (nest/collab/collab.service.ts);
+ // the old `multi_choice` name was silently dropped, losing desktop multi-choice.
+ await onCreate({ question: question.trim(), options: options.filter(o => o.trim()), multiple_choice: multiChoice })
onClose()
} catch {} finally { setSubmitting(false) }
}
@@ -232,7 +234,7 @@ function PollCard({ poll, currentUser, canEdit, onVote, onClose, onDelete, t }:
<Clock size={8} /> {remaining}
</span>
)}
- {poll.multi_choice && (
+ {poll.multiple_choice && (
<span style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 600, color: 'var(--text-faint)', background: 'var(--bg-tertiary)', padding: '2px 7px', borderRadius: 99 }}>
{t('collab.polls.multiChoice')}
</span>
diff --git a/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx b/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx
index 6c4c0b2a4..fd4dc280e 100644
--- a/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx
+++ b/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx
@@ -97,8 +97,8 @@ export default function MCollabPolls({ planner }: MCollabPollsProps) {
const res = (await collabApi.createPoll(tripId, {
question: data.question,
options: data.options,
- // Server reads `data.multiple || data.multiple_choice` (collabService.ts) —
- // both are sent so either shape lands correctly.
+ // Server reads `data.multiple || data.multiple_choice`
+ // (nest/collab/collab.service.ts) — both are sent so either shape lands.
multiple: data.multipleChoice,
multiple_choice: data.multipleChoice,
deadline: data.deadline || undefined,