From c79658b3e55d71c2575efad527401fb4aca5b5fc Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:48:19 +0000 Subject: [PATCH] Implement plan to remove public toggle --- .../timeline/TimelineEventEditorDialog.tsx | 25 +------------------ src/lib/entitySubmissionHelpers.ts | 4 +-- src/types/timeline.ts | 3 --- .../process-selective-approval/index.ts | 2 +- ...7_0e3d5b12-fe41-4041-81a0-fcf6e7484174.sql | 13 ++++++++++ 5 files changed, 17 insertions(+), 30 deletions(-) create mode 100644 supabase/migrations/20251015194717_0e3d5b12-fe41-4041-81a0-fcf6e7484174.sql diff --git a/src/components/timeline/TimelineEventEditorDialog.tsx b/src/components/timeline/TimelineEventEditorDialog.tsx index 836b2ad8..1f97317a 100644 --- a/src/components/timeline/TimelineEventEditorDialog.tsx +++ b/src/components/timeline/TimelineEventEditorDialog.tsx @@ -41,7 +41,7 @@ import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { Button } from '@/components/ui/button'; import { DatePicker } from '@/components/ui/date-picker'; -import { Switch } from '@/components/ui/switch'; + import { Loader2, Trash } from 'lucide-react'; import { useAuth } from '@/hooks/useAuth'; import { useToast } from '@/hooks/use-toast'; @@ -129,14 +129,12 @@ export function TimelineEventEditorDialog({ to_entity_id: existingEvent.to_entity_id || '', from_location_id: existingEvent.from_location_id || '', to_location_id: existingEvent.to_location_id || '', - is_public: existingEvent.is_public, } : { event_type: 'milestone', event_date: new Date(), event_date_precision: 'day', title: '', description: '', - is_public: true, }, }); @@ -386,27 +384,6 @@ export function TimelineEventEditorDialog({ )} /> - ( - -
- Public Event - - Make this event visible to all users - -
- - - -
- )} - /> - {isEditing && existingEvent?.approved_by === null && ( diff --git a/src/lib/entitySubmissionHelpers.ts b/src/lib/entitySubmissionHelpers.ts index a25ee943..cd5bda8a 100644 --- a/src/lib/entitySubmissionHelpers.ts +++ b/src/lib/entitySubmissionHelpers.ts @@ -968,7 +968,7 @@ export async function submitTimelineEvent( to_entity_id: data.to_entity_id, from_location_id: data.from_location_id, to_location_id: data.to_location_id, - is_public: data.is_public ?? true, + is_public: true, // All timeline events are public }; const { error: itemError } = await supabase @@ -1057,7 +1057,7 @@ export async function submitTimelineEventUpdate( to_entity_id: data.to_entity_id, from_location_id: data.from_location_id, to_location_id: data.to_location_id, - is_public: data.is_public ?? true, + is_public: true, // All timeline events are public }; const { error: itemError } = await supabase diff --git a/src/types/timeline.ts b/src/types/timeline.ts index 86e405a0..142af1e3 100644 --- a/src/types/timeline.ts +++ b/src/types/timeline.ts @@ -46,7 +46,6 @@ export interface TimelineEvent { to_location_id?: string; // Metadata - is_public: boolean; display_order: number; created_by?: string; approved_by?: string; @@ -73,8 +72,6 @@ export interface TimelineEventFormData { to_entity_id?: string; from_location_id?: string; to_location_id?: string; - - is_public?: boolean; } /** diff --git a/supabase/functions/process-selective-approval/index.ts b/supabase/functions/process-selective-approval/index.ts index ea842f17..8e8735f8 100644 --- a/supabase/functions/process-selective-approval/index.ts +++ b/supabase/functions/process-selective-approval/index.ts @@ -899,7 +899,7 @@ async function createTimelineEvent( to_entity_id: data.to_entity_id, from_location_id: data.from_location_id, to_location_id: data.to_location_id, - is_public: data.is_public ?? true, + is_public: true, // All timeline events are public created_by: submitterId, approved_by: approvingUserId, submission_id: submissionId, diff --git a/supabase/migrations/20251015194717_0e3d5b12-fe41-4041-81a0-fcf6e7484174.sql b/supabase/migrations/20251015194717_0e3d5b12-fe41-4041-81a0-fcf6e7484174.sql new file mode 100644 index 00000000..226027d2 --- /dev/null +++ b/supabase/migrations/20251015194717_0e3d5b12-fe41-4041-81a0-fcf6e7484174.sql @@ -0,0 +1,13 @@ +-- Ensure all existing timeline events are public +UPDATE entity_timeline_events +SET is_public = true +WHERE is_public = false; + +-- Add check constraint to enforce all events are public +ALTER TABLE entity_timeline_events +ADD CONSTRAINT timeline_events_must_be_public +CHECK (is_public = true); + +-- Add comment to document this requirement +COMMENT ON COLUMN entity_timeline_events.is_public IS +'All timeline events are public. This column is kept for potential future use but must always be true.'; \ No newline at end of file