mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 03:45:06 +03:00
## What - Route docs page feedback **comments** to Postgres instead of `POST /platform/feedback/docs` (which created duplicate Linear issues); the 👍/👎 vote is unchanged - Store the comment on the **existing `feedback` row**: add `user_id` / `title` / `comment`; submitting a comment updates the vote row the user just created - Capture the real `user_id` (`default auth.uid()`) so feedback is tied to the user - Owner-scoped RLS — `select`/`update` for authenticated users where `user_id = auth.uid()`; anonymous votes stay insert-only - Linear issues still get created, now via the data pipeline instead of directly from the UI ## Linear [DATAENG-1468](https://linear.app/supabase/issue/DATAENG-1468) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Feedback follow-ups now support saving a detailed title and comment, tied to the signed-in user. * **Bug Fixes** * Follow-up submissions are now persisted in Supabase, ensuring the vote and later details stay consistent for logged-in users. * **Tests** * Added coverage for updating a feedback entry’s title and comment. * **Chores** * Removed the previous feedback submission endpoint/mutation flow in favor of a Supabase update-based approach. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
862 B
TypeScript
30 lines
862 B
TypeScript
import type { SupabaseClient } from '@supabase/supabase-js'
|
|
import type { Database } from 'common'
|
|
import { pick } from 'lodash-es'
|
|
|
|
type FeedbackComment = {
|
|
id: number
|
|
title: string
|
|
comment: string
|
|
}
|
|
|
|
const updateDocsFeedbackComment = (
|
|
supabase: SupabaseClient<Database>,
|
|
{ id, title, comment }: FeedbackComment
|
|
) => supabase.from('feedback').update({ title, comment }).eq('id', id)
|
|
|
|
/**
|
|
* Gets the tab selection state from the URL search params.
|
|
*
|
|
* Sanitizes by including only those search params that are explicitly marked
|
|
* as query groups.
|
|
*/
|
|
const getSanitizedTabParams = () => {
|
|
const searchParams = new URLSearchParams(window.location.search)
|
|
const queryGroups = searchParams.getAll('queryGroups')
|
|
|
|
return pick(Object.fromEntries(searchParams.entries()), queryGroups)
|
|
}
|
|
|
|
export { updateDocsFeedbackComment, getSanitizedTabParams }
|