Skip to content

admin notify: add --user <username> for per-user emails #381

Closed

Description

@neuromechanist

Problem

nemar admin notify currently only supports broadcast groups (--to all|admins|members). There is no way to send a transactional email to a single user.

This came up while following up with a user who hit a sandbox bug (#377): the only options were to broadcast to everyone (overkill) or skip the CLI and send mail outside the audit trail.

Proposal

Add a --user <username> option to nemar admin notify that sends to exactly one user, mutually exclusive with --to.

nemar admin notify --user AlexWoods1 \
  --subject "Your sandbox issue is fixed in v0.8.3" \
  --body-file ./alex-followup.md

Backend

POST /admin/notify schema (in backend/src/routes/admin.ts:4989) currently accepts to: enum(all, admins, members). Extend to accept user: string as an alternative; reject if both are provided.

getBroadcastRecipients in backend/src/services/broadcast.ts would gain a single-user lookup path that returns [{user_id, email, ...}] for the given username (404 if not found, 400 if not approved/has no email).

The downstream sendBroadcast already iterates over a recipient list, so per-user is just recipients.length === 1 and the audit log row records group: \user:${username}`instead ofall|admins|members`.

CLI

src/commands/admin/notify.ts (or wherever the command lives) currently passes to to the API. Add --user option, validate exclusivity with --to, surface 404 if user not found.

Audit

The existing audit_log row should record the target username so admin history shows who got pinged. Reuse the same notify action; differentiate via the details JSON (e.g. { recipient: \"user:Alex\" } vs { recipient: \"group:members\" }).

Acceptance

  • nemar admin notify --user <username> --subject ... --body ... sends to exactly that user.
  • --user and --to are mutually exclusive (CLI rejects with usage error).
  • Unknown username returns 404.
  • User without email or unapproved returns 400 with explanation.
  • --dry-run works for --user and shows the single recipient.
  • Audit log distinguishes per-user vs broadcast in the details JSON.

Out of scope

  • A future --users <a,b,c> for ad-hoc small lists. Defer until there's a real ask.

Related

Activity

  1. added
    enhancement
    on Apr 28, 2026
  2. neuromechanist commented on May 14, 2026

    @neuromechanist
    ContributorAuthor

    Merged via PR #461 (admin notify --user).

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions