diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index ac96824..5bff943 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -44,7 +44,7 @@ const Index = () => { const fetchSignatureCount = async () => { const { count } = await supabase - .from('petition_signatures_public') + .from('petition_signatures') .select('*', { count: 'exact', head: true }); setSignatureCount(count || 0); diff --git a/src/pages/Testimonies.tsx b/src/pages/Testimonies.tsx index 567f9ac..2c71e87 100644 --- a/src/pages/Testimonies.tsx +++ b/src/pages/Testimonies.tsx @@ -47,16 +47,16 @@ const Testimonies = () => { const fetchSignatures = async () => { try { - // Get total count from public view (emails hidden) + // Get total count const { count } = await supabase - .from('petition_signatures_public') + .from('petition_signatures') .select('*', { count: 'exact', head: true }); setTotalCount(count || 0); - // Get signatures with comments from public view (emails hidden) + // Get signatures with comments const { data, error } = await supabase - .from('petition_signatures_public') + .from('petition_signatures') .select('*') .not('comment', 'is', null) .order('created_at', { ascending: false }); diff --git a/supabase/migrations/20251026150621_bda97e31-e75f-4dc9-90fc-5fd0454e600a.sql b/supabase/migrations/20251026150621_bda97e31-e75f-4dc9-90fc-5fd0454e600a.sql new file mode 100644 index 0000000..683db00 --- /dev/null +++ b/supabase/migrations/20251026150621_bda97e31-e75f-4dc9-90fc-5fd0454e600a.sql @@ -0,0 +1,16 @@ +-- Revert to public access policies +DROP POLICY IF EXISTS "Only authenticated users can view all signature data" ON public.petition_signatures; +DROP POLICY IF EXISTS "Anyone can sign the petition" ON public.petition_signatures; + +-- Restore original public access +CREATE POLICY "Anyone can view signatures" +ON public.petition_signatures +FOR SELECT +TO anon, authenticated +USING (true); + +CREATE POLICY "Anyone can sign the petition" +ON public.petition_signatures +FOR INSERT +TO anon, authenticated +WITH CHECK (true); \ No newline at end of file