Skip to content

feat(notifications): Discord embed for proposal.reviewed (approve/reject/needs_changes) #4

Closed

Description

@smmariquit

Status: spec — blocked on room-tba emitter
Last verified: 2026-07-03
Pairs with: uplbtools/room-tba#222

Summary

Handle proposal.reviewed on POST /notifications and post a calm embed to #contributors when an editor approves, rejects, or requests changes on a contributor proposal.

Today the bot only delivers proposal.submitted (src/notifications/delivery/discord.ts). The event type is already in the shared contract (src/notifications/types.ts, docs/notifications.md) but has no delivery handler.

Ingress (unchanged)

POST /notifications + x-notification-secret: NOTIFICATION_INGRESS_SECRET

Expected payload (proposal.reviewed)

Field Type Notes
proposalId number
outcome "approved" | "rejected" | "needs_changes"
entityType string e.g. room, building, create_building
entityId number 0 for create proposals
entityLabel string Human label from room-tba
submitterName string
reviewedBy string Editor display name
adminNote string | null Reject / needs-changes note

Idempotency key from room-tba: proposal:<id>:reviewed:<outcome>

Delivery

  • Channel: CHANNEL_CONTRIBUTORS_ID (same as proposal.submitted)
  • Embed:
    • Approved — green (0x16a34a), title e.g. “Proposal approved”
    • Rejected — red (0xdc2626), title e.g. “Proposal rejected”
    • Needs changes — amber (0xd97706), title e.g. “Changes requested”
  • Fields: entity label + type, submitter, reviewer, proposal ID, admin note when present
  • Footer: existing BOT_FOOTER; optional link to room-tba.uplbtools.me entity or /?editor=login

Acceptance criteria

  • proposal.reviewed routes to #contributors with outcome-appropriate color/title
  • Duplicate idempotencyKey skipped (existing 24h TTL map)
  • Unknown/malformed payload logged; returns 4xx without crashing worker
  • docs/notifications.md documents payload table
  • Test in src/notifications/notifications.test.ts or server.test.ts for sample envelope
  • Manual: curl sample POST → embed appears in #contributors

Implementation pointers

  • src/notifications/types.ts — ProposalReviewedPayload type
  • src/notifications/delivery/discord.ts — proposalReviewedEmbed() + case "proposal.reviewed"
  • Mirror style of existing proposalSubmittedEmbed()

Depends on

  • room-tba#222 — emit event from admin approve/reject/changes API routes

Non-goals

  • Discord DM to submitter
  • Separate channel per outcome

Activity

  1. smmariquit commented on Jul 3, 2026

    @smmariquit
    ContributorAuthor

    Shipped in #5 — deployed Heroku v23.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions