Skip to content

Allow group members to record settlements on behalf of the payer#5

Merged
ClementLSW merged 1 commit into
mainfrom
copilot/allow-member-record-settlement
May 27, 2026
Merged

Allow group members to record settlements on behalf of the payer#5
ClementLSW merged 1 commit into
mainfrom
copilot/allow-member-record-settlement

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Contributor

Settlement recording was restricted to the payer in both UI (isOwnedByMe) and RLS (paid_by = auth.uid() behavior), which blocked legitimate member-driven settlement updates. This change allows any group member to record a settlement while preserving payer identity from the transaction (transaction.from).

  • Database policy (Supabase migration)

    • Replaced Members can create settlements insert policy to authorize by group membership only.
    • New policy checks public.is_group_member(group_id) so recorder and payer can differ.
  • Settle-up UI gating (GroupDetail.jsx)

    • Removed isOwnedByMe gating from the Paid action.
    • Removed isOwnedByMe gating from the confirm/cancel/amount row.
    • Kept isOwnedByMe for other existing UI copy/logic outside settlement action visibility.
  • Recorder context UX

    • Added inline note during confirmation when recorder is not payer:
      • “Recording payment on behalf of {fromName}”
drop policy "Members can create settlements" on public.settlements;

create policy "Members can create settlements"
  on public.settlements for insert
  with check (public.is_group_member(group_id));

@netlify

netlify Bot commented May 27, 2026

Copy link
Copy Markdown

Deploy Preview for omoneypmoney ready!

Name Link
🔨 Latest commit 011b11f
🔍 Latest deploy log https://app.netlify.com/projects/omoneypmoney/deploys/6a166a4381e2bb00072921c5
😎 Deploy Preview https://deploy-preview-5--omoneypmoney.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ClementLSW ClementLSW marked this pull request as ready for review May 27, 2026 03:51
Copilot AI review requested due to automatic review settings May 27, 2026 03:51
@ClementLSW ClementLSW merged commit 56a157b into main May 27, 2026
4 of 5 checks passed
Copilot AI review requested due to automatic review settings May 27, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants