Skip to content

Co-organizers: invite editors to a campaign (money stays with the owner) #253

Closed

Description

@JOY

Why

JOY (2026-11-19) asked for parity with GoFundMe (team fundraising, co-organizers). Today one DOS ID account owns a campaign alone.

Scope (v1)

  • give.campaign_members (campaign_id, user_id, role editor, invited_by, accepted_at) in DOS/DOS.Me migrations, RLS and pgTAP.
  • The owner invites by link (single use, expires); the invitee accepts while signed in; the owner removes members.
  • Editors may edit content while the campaign is editable, manage milestones, media and reward tiers within the same rules as the owner, post updates, and answer or hide comments.
  • Money stays with the owner only: receiving accounts, statements, disbursements, refunds, fulfillment data with donor contact details, submitting for review. Every money RPC keeps its current owner check; add tests proving an editor is refused.
  • The campaign page shows the team.

Out of scope

Ownership transfer, team fundraising pages with per-member totals.

Done when

On beta: an owner invites an editor who edits content and posts an update but is refused on every money page and RPC; tests pass.

Activity

  1. JOY commented on Nov 18, 2026

    @JOY
    ContributorAuthor

    Campaigns PO (line:campaigns): filed the DOS/DOS.Me database prerequisite as #264 (line:platform -> Give Product Owner). Ready to build the apps/web co-organizer invite, editor workspace guards, and public team block as soon as #264 lands on DOS.Me dev.

  2. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    DOS/Give#264 database prerequisite is now merged into DOS/DOS.Me dev via https://github.com/DOS/DOS.Me/pull/1856 (supabase/migrations/20261129170000_give_campaign_members.sql, 172 pgTAP assertions in supabase/tests/database/give_campaign_members.test.sql).

    RPC Signatures & Return Shapes (schema: give)

    All authenticated RPCs use auth.uid() from the user JWT (dbAs(session.accessToken).rpc(...) — never pass a spoofable actor id).

    1. Discover role & managed campaigns

      • give.managed_campaigns(p_campaign_id uuid DEFAULT NULL) RETURNS SETOF give.campaigns (authenticated)
        • Now returns campaigns where the caller is the owner, an accepted editor, or staff, preserving SETOF give.campaigns so existing PostgREST embeds (.select(CAMPAIGN_WITH_REFS)) keep working unchanged.
      • give.my_campaign_roles(p_campaign_ids uuid[] DEFAULT NULL) RETURNS TABLE (campaign_id uuid, role text) (authenticated)
        • Returns role IN ('owner', 'editor') for the caller (filtered to up to 200 ids when p_campaign_ids is passed). Use this (alongside campaign.organizer_id === session.user.id) to hide owner-only controls in /me/campaigns and /me/campaigns/[id].
      • give.is_campaign_editor(p_campaign_id uuid) RETURNS boolean / give.can_edit_campaign(p_campaign_id uuid) RETURNS boolean (anon, authenticated, service_role) — reusable for editor comment reply/hide once #250 lands.
    2. Invite lifecycle & member management

      • give.create_campaign_member_invite(p_campaign_id uuid, p_expires_in_hours integer DEFAULT 168, p_note text DEFAULT NULL) RETURNS TABLE (invite_id uuid, token text, expires_at timestamptz) (authenticated, owner-only)
        • Returns the 64-char hex raw token once (only SHA-256 hash is stored; never logged). Caps: max 20 active members, max 20 active pending invites, expiry 1–720 hours, note <= 120 chars, rate limit 30/hour per campaign and 60/hour per owner.
      • give.revoke_campaign_member_invite(p_invite_id uuid) RETURNS text (authenticated, owner-only)
        • Returns 'revoked' (idempotent on already-revoked invites).
      • give.preview_campaign_member_invite(p_token text) RETURNS TABLE (status text, campaign_id uuid, campaign_slug text, campaign_title text, organizer_display_name text, role text, expires_at timestamptz) (authenticated, service_role)
        • status IN ('pending', 'revoked', 'accepted', 'expired', 'unavailable', 'invalid'). Only populates campaign metadata when status = 'pending'; all non-pending statuses return NULL metadata (no draft title leak).
      • give.accept_campaign_member_invite(p_token text) RETURNS TABLE (campaign_id uuid, campaign_slug text, role text, accepted_at timestamptz) (authenticated)
        • Single-use atomic consumption while signed in. Token cannot be replayed even after removal. Accidental click by owner or already-accepted editor raises an error without consuming the link.
      • give.remove_campaign_member(p_campaign_id uuid, p_user_id uuid) RETURNS text (authenticated, owner-only)
        • Returns 'removed'; immediately revokes all editor permissions and serializes with concurrent editor writes.
      • give.list_campaign_members(p_campaign_id uuid) RETURNS TABLE (user_id uuid, role text, display_name text, avatar_url text, invited_by uuid, accepted_at timestamptz, created_at timestamptz) (authenticated, owner & staff only)
        • Never exposes email, phone, legal_name; suppresses deleted/inactive profile & metadata fields ('Co-organizer' / NULL avatar).
      • give.list_campaign_member_invites(p_campaign_id uuid) RETURNS TABLE (invite_id uuid, campaign_id uuid, role text, note text, expires_at timestamptz, accepted_at timestamptz, accepted_by uuid, accepted_by_display_name text, revoked_at timestamptz, created_at timestamptz, status text) (authenticated, owner & staff only)
        • Never exposes token_hash; suppresses deleted/inactive invitee metadata.
    3. Public campaign team display (/campaigns/[slug])

      • give.campaign_public_team(p_campaign_id uuid) RETURNS TABLE (member_role text, display_name text, avatar_url text, kind text, verification_status text, joined_at timestamptz) (anon, authenticated, service_role)
        • Returns rows only for public-status campaigns (give.is_public_status). Owner is ordered first (member_role = 'owner'), followed by accepted editors (member_role = 'editor') ordered by joined_at ASC. Never exposes user_id, legal_name, phone, email, private dos_name handles, or deleted/inactive profile metadata.

    Capability Boundary

    • Accepted editor allowed (same status rules as owner):
      • Read campaign in managed_campaigns, campaigns, campaign_media, campaign_milestones, campaign_updates, campaign_status_events, reward_tiers.
      • Update editable campaign content (give.campaigns while draft / changes_requested; column grants still block organizer_id, status, review_note, allow_monthly, payment columns).
      • Manage give.campaign_milestones while draft / changes_requested.
      • Manage give.reward_tiers via save_reward_tier, delete_reward_tier, reorder_reward_tiers (draft / changes_requested) and retire_reward_tier (same status rules as owner).
      • Insert, update, publish, and delete their own unpublished give.campaign_updates (not cancelled / suspended); cannot edit/delete owner/other-editor drafts or published updates.
    • Strictly owner-only (editors refused at DB RLS + RPC layers):
      • Receiving accounts, bindings, swaps (receiving_accounts, account_bindings, account_swap_requests, bind_receiving_account, release_account_binding, request_account_swap, cancel_account_swap, campaigns_waiting_for_account).
      • Statement imports & unmatched matching (statement_import_batches, statement_import_rows, stage_statement_import, bank_transactions, transaction_matches, match_transaction).
      • Disbursements, refunds & ledger (disbursements, disbursement_evidence, ledger_entries, campaign_paid, record_disbursement, add_disbursement_evidence).
      • Fulfillment & backer PII (contributions shipping/guest PII reads, set_pledge_fulfillment).
      • Monthly plans (set_campaign_monthly, campaign_plan_supporters).
      • Status transitions & draft deletion (transition_campaign submitForReview / cancelCampaign, DELETE FROM give.campaigns).
      • Member & invite management (create/revoke/list_campaign_member_invites, list/remove_campaign_member).

    Error Codes (GIVE_*)

    • GIVE_AUTH_REQUIRED (42501): unauthenticated caller
    • GIVE_CAMPAIGN_OWNER_ONLY (42501): non-owner calling owner-only team/invite RPC (uniform across missing campaign/invite ids to prevent enumeration)
    • GIVE_CAMPAIGN_NOT_INVITABLE: <status> (23514): campaign is cancelled or suspended
    • GIVE_INVITE_EXPIRY_INVALID (23514): p_expires_in_hours outside 1..720
    • GIVE_INVITE_NOTE_TOO_LONG (23514): p_note exceeds 120 chars
    • GIVE_CAMPAIGN_MEMBER_LIMIT: 20 (23514): campaign already has 20 accepted editors
    • GIVE_CAMPAIGN_INVITE_LIMIT: 20 (23514): campaign already has 20 active pending invites
    • GIVE_RATE_LIMITED: <seconds> (PT429): invite creation rate limit exceeded (30/hr per campaign, 60/hr per owner)
    • GIVE_INVITE_INVALID (P0002): malformed or unknown token
    • GIVE_INVITE_REVOKED (23514): invite was revoked
    • GIVE_INVITE_ALREADY_USED (23514): single-use invite already consumed (cannot be replayed even after removal)
    • GIVE_INVITE_ALREADY_ACCEPTED (23514): cannot revoke an already-accepted invite
    • GIVE_INVITE_EXPIRED (23514): invite past expires_at
    • GIVE_ALREADY_CAMPAIGN_OWNER (23514): owner clicked their own invite (token not consumed)
    • GIVE_ALREADY_CAMPAIGN_MEMBER (23505): caller is already an accepted editor (token not consumed)
    • GIVE_CAMPAIGN_MEMBER_NOT_FOUND (P0002): user is not a member of the campaign
    • GIVE_CAMPAIGN_NOT_EDITABLE (42501): campaign status is not editable or editor membership was revoked
  3. added
    po:agyOwned by Antigravity PO (mutual-exclusion parallel PO label)
    on Nov 22, 2026
  4. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    claim: executor=Antigravity session=532bdd1f-f159-4548-8a59-a47af6a07c07 scope="apps/web co-organizer invites, editor workspace guards, /me/campaigns/[id] team tab & public team block" branch=antigravity/253-co-organizers target=2026-11-22

  5. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    checkpoint: session=532bdd1f-f159-4548-8a59-a47af6a07c07 PR #298 opened into dev at 16f7c58ea96bef7b7680145cf0b208f8788f190e (rebased onto origin/dev after #250 and #251). Local checks pass (format:check, lint, typecheck, build, 179/179 Vitest files / 2,619 tests). Running independent security & DESIGN.md review and CI checks.

  6. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    checkpoint: session=532bdd1f-f159-4548-8a59-a47af6a07c07 PR #298 squash-merged into dev at 4a07a3da7ad47c8cf4c1cce651b4ed25d34cd12c (head SHA 25aeabac45cb2678e41d21607c7bbc7fcfbc9e63 after PO acceptance). Vercel dev/beta (https://beta.give.vn) deployment completed: https://vercel.com/metados/give/8ezVFYbejtyjwFWeyfJfXC7Ukcf7. Keeping #253 open for Production promotion (dev -> main) by Give Product Owner once DOS/DOS.Me#1856 reaches main and JOY approves.

  7. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    handoff: session=532bdd1f-f159-4548-8a59-a47af6a07c07 to=83b36fa6-8c08-49d6-aeec-63bab02a5e52

    Done: Implemented apps/web co-organizers (editors) for DOS/Give#253 in PR #298 (#298), squash-merged into DOS/Give dev at 4a07a3da7ad47c8cf4c1cce651b4ed25d34cd12c (head SHA 25aeabac45cb2678e41d21607c7bbc7fcfbc9e63, PO acceptance posted). Worktree /Users/JOY/Projects/Give/.claude/worktrees/253-co-organizers and local branch removed.
    Evidence: Local pnpm format:check, pnpm lint, pnpm typecheck, pnpm build, and 180/180 Vitest files (2,620/2,620 tests) passed. PR #298 required checks (Verify build / Lint, Verify build / Build all apps) passed on 25aeabac45cb2678e41d21607c7bbc7fcfbc9e63. Independent fresh-context security/code review + PO flagship review approved with 0 blocking findings. Vercel dev/beta (https://beta.give.vn) deployment completed: https://vercel.com/metados/give/8ezVFYbejtyjwFWeyfJfXC7Ukcf7.
    Remaining: Beta end-to-end verification (owner invites editor, editor edits content/posts update and is refused on money surfaces) and Production promotion (dev -> main / give.vn) handled by Give Product Owner (Claude PO) once DOS/DOS.Me#1856 reaches main and JOY approves.
    Next step: Coordinate beta E2E verification and Production promotion with Give Product Owner when DOS/DOS.Me#1856 is promoted to main.
    Blockers: DOS/DOS.Me#1856 (20261129170000_give_campaign_members.sql) promotion to DOS/DOS.Me main + JOY Production approval (cleared by Give Product Owner / JOY).
    Branch: antigravity/253-co-organizers merged into dev at 4a07a3da7ad47c8cf4c1cce651b4ed25d34cd12c.

  8. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    claim: executor=Antigravity session=83b36fa6-8c08-49d6-aeec-63bab02a5e52 scope="Production steps, waiting for Claude PO (Give Product Owner) DOS/DOS.Me#1856 + #298 dev -> main promotion" branch=antigravity/253-co-organizers target=2026-11-28

  9. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    checkpoint: session=83b36fa6-8c08-49d6-aeec-63bab02a5e52 waiting for Production promotion (DOS/DOS.Me main then DOS/Give main / give.vn) by Give Product Owner (Claude Code) after JOY approval; #298 merged at 4a07a3d and deployed to https://beta.give.vn (Vercel success).

  10. added 2 commits that reference this issue on Nov 22, 2026
  11. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    done: session=83b36fa6-8c08-49d6-aeec-63bab02a5e52
    Promoted to Production and verified live:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    line:campaignsProduct line: campaignspo:agyOwned by Antigravity PO (mutual-exclusion parallel PO label)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions