Skip to content

feat(m5): Telegram identity, event community isolation & operational workflows - #35

Open
Satelink-Protocol wants to merge 2 commits into
feature/m4-3-4-contract-decisionfrom
feature/m5-telegram-operational-workflows
Open

Satelink-Protocol wants to merge 2 commits into
feature/m4-3-4-contract-decisionfrom
feature/m5-telegram-operational-workflows

Conversation

@Satelink-Protocol

Copy link
Copy Markdown
Contributor

NIGHTLIFEZ — Milestone M5: Telegram & Operational Workflows

Continues the NIGHTLIFEZ roadmap from the closed M4.3.4 baseline.

1. Functional Scope & Changes

A. Telegram Identity & Account Linking

  • Implemented cryptographic, single-use, 15-minute account linking tokens (account_link_tokens table via Migration 018).
  • Web endpoints: POST /api/auth/telegram/link-token and GET /api/auth/telegram/link-status.
  • Telegram bot command: /start link_<token> securely binds authenticated web sessions and guest bookings to the Telegram account without IDOR or insecure identity assumptions.
  • Handled guest checkout claiming via /start claim_upi_<orderId>_<guestToken>.

B. Event-Specific Telegram Communities (Strict Isolation)

  • STRICT PROHIBITION ENFORCED: No global attendee group.
  • Eliminated shared attendee group fallbacks in lib/services/invites.js.
  • Each event exclusively uses its dedicated private supergroup (events.telegram_chat_id). Events without a dedicated chat ID safely return null and notify guests that venue details are on their booking pass, rather than dumping them into a shared group.
  • Preserved single-use (member_limit: 1), 24-hour expiring invitation links.
  • Implemented automatic revocation on booking refund or cancellation, and immediate kick/ban-unban of unauthorized joiners attempting to reuse leaked invite links.

C. Operational Notifications & Quiet Hours

  • Added notification preferences and quiet hours to users table (reminders_enabled, quiet_hours_enabled, quiet_hours_start, quiet_hours_end).
  • Web endpoints: GET /api/me/notification-preferences and PATCH /api/me/notification-preferences.
  • Telegram bot command: /quiet_hours (supports view, on, off, and custom time windows in Asia/Kolkata timezone).
  • Transactional outbox (lib/services/notifications.js) respects quiet hours: non-urgent alerts (announcements, reminders) are deferred until the end of the quiet hours window, while urgent notices (booking confirmations, refunds, cancellations) deliver immediately.
  • Added operational notification handlers: event_reminder, event_update, host_application_received, host_approved.

D. Safety, Support & Moderation

  • Enhanced bot /report workflow with mandatory national emergency helpline (112) and Women's Helpline (1091 / 181).
  • Implemented Telegram report validation (minimum 10 characters) and rate limiting (max 5 reports per hour per user).
  • Confidential report ingestion into reports table with moderator audit status.
  • Added emergency helpline references to /help, /support, and /paysupport.

E. Operational Recovery

  • When an attendee books on the web before starting the bot, Telegram 403 (unreachable user) is recorded in the notification outbox.
  • When the user subsequently sends /start to the bot, the bot automatically detects unfulfilled confirmed bookings and delivers the pending private group invite immediately.

2. Safeguards & Invariants

  • ENABLE_LIVE_PAYMENTS=false strictly preserved across all environments.
  • Zero live payments or refunds initiated.
  • Preserved all prior migrations (003 through 017); Migration 018 is strictly additive.
  • No production database, DNS, or Telegram BotFather credentials altered.
  • All tests passing: 487 unit/integration tests pass (16/16 in dedicated test/telegram-workflows.test.js), 157 Playwright E2E tests pass, 141/141 files clean on ESLint.

3. Reviewer Checklist

  • Dedicated event group isolation verified (no cross-event group leakage).
  • Account linking verified without IDOR.
  • Quiet hours deferral verified for non-urgent notifications.
  • Full test suite, lint, and Playwright E2E green.

@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strangersmeetup Ready Ready Preview Nov 5, 2026 5:49pm UTC

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.

1 participant