Skip to content

Organizers can remove one person from a slot #377

Description

@richshaw

Part of #347, step 2 of 3. Do #375 first.

Why

An organizer can't take one person off a slot today. The only way is to delete the whole slot (deleteSlot in src/services/slots.ts), which removes everyone on it, and the builder gives no warning.

Once email can be optional (#347), someone who loses their edit link has no way to cancel, so the organizer has to be able to do it for them. It is useful on its own too: someone asks the organizer to take them off, or signs up twice by mistake.

What we're building

  • A Remove action on each active row of the Responses tab (src/app/app/(chrome)/signups/[id]/responses/page.tsx), with a confirmation step that names the person and the slot.
  • Removing cancels that one sign-up and frees its spots. The person's edit link then shows the cancelled message from A cancelled sign-up's edit link still opens the edit form #375. Their "You're signed up" banner disappears, because the cookie lookup already ignores cancelled sign-ups.
  • Editors and above can remove. Viewers can't.
  • Decided: the removed person gets no email.

Plan

Service. cancelCommitmentAsOrganizer(db, actor, commitmentId) in src/services/commitments.ts, next to cancelOwnCommitment and modelled on it:

  • Read the commitment, load its signup with readLiveSignup, and call requireWorkspaceWrite(actor, signup.workspaceId) before anything else.
  • In the transaction, lock the commitment row and check again that the signup is live. Then update it to cancelled where it is still active and workspace_id matches. Reuse isActiveCommitment.
  • Removing an already-cancelled sign-up succeeds and changes nothing. A no_show row is a conflict, as in cancelOwnCommitment.
  • No slot lock is needed, because a cancel only gives places back. Keep the lock order in src/services/locks.ts.

Activity.

  • Add a new commitment.removed event to ACTIVITY_EVENTS (src/db/schema/activity.ts), with an organizer actor and payload { commitmentId, participantId, slotId }.
  • Write it in the same transaction, through activityActor(actor), so a later MCP tool records viaClientId with no extra work.
  • Add it to docs/telemetry.md.

UI.

  • A server action in src/app/app/(chrome)/signups/[id]/actions.ts, following deleteSignupAction.
  • One small client confirm component, like settings/delete-signup-form.tsx.
  • Responses is budgeted at 124 KB in budgets.json, so run pnpm budgets.

Copy.

  • Row action: "Remove". Cancelled rows show no action.
  • Confirmation: "Remove Sam Example from Fruit and water? Their spot opens up for someone else. They won't get an email about it."
  • The message on the person's link stays neutral ("This sign-up was cancelled"), so it covers both cancelling and being removed. Don't add a column to record who cancelled it.

Out of scope

  • An MCP tool for removing someone (later).
  • Emailing the removed person.

Done when

  • An editor can remove one person from the Responses tab. The spot frees up on the public page, and the person's link shows the cancelled message.
  • DB tests cover:
    • removing someone
    • removing them again changes nothing
    • a viewer is refused
    • a commitment from another workspace is not found
    • a deleted signup is not found
    • the activity row is written in the same transaction
  • An e2e smoke covers the Remove flow.
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test and pnpm test:db pass.
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

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions