fix: outreach A/B variants display and thread linking#731
Merged
Conversation
PostgreSQL bigint values may be returned as strings in JavaScript. Convert variant IDs and related numeric fields to proper JS numbers so the frontend can correctly match variant stats with variants. This fixes the A/B Variants tab showing no data due to type mismatch in the comparison `s.variant_id === v.id` (string vs number). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Link outreach records to unified_threads when user responds to DM - Add linkOutreachToThread() method to insights-db.ts - Create reusable ThreadWidget (js/thread-widget.js, css/thread-widget.css) - Expandable inline thread viewer - Fetches from /api/admin/addie/threads/:id - Supports compact mode, timestamps, max messages - Update admin-users.html to use thread widget: - Outreach history: expandable thread view per outreach - Recent conversations: expandable thread view per conversation - Update admin-outreach.html history tab: - Add Thread column with expandable widget This enables viewing full conversation context directly from outreach history and user profiles without switching pages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add XSS protection: validate/sanitize channel, threadId, containerId - Add LRU cache eviction (max 50 entries) to prevent memory growth - Add UUID validation for threadId in thread widget and linkOutreachToThread - Add container ID validation (alphanumeric, hyphens, underscores) - Add null checks in toggleExpand to prevent crashes on missing elements - Escape thread_id in data attributes in admin-outreach.html - Extract normalizeVariant() helper for consistent BigInt conversion - Apply Number() conversion consistently to createVariant, getVariant, updateVariant 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/admin/outreachChanges
insights-db.ts): Convert PostgreSQL BigInt values to JavaScript Numbers so frontend comparison works correctlythread-widget.js,thread-widget.css): Reusable component with expandable inline display, caching, and lazy loadingbolt-app.ts,insights-db.ts): When a user responds to outreach and a thread is created, store the thread_id in member_outreachTest plan
/admin/outreachand verify A/B variants table shows data with response rates/admin/users/:idand verify outreach history shows thread links🤖 Generated with Claude Code