Support tickets are members-only (Marty 2026-10-24, after a throwaway-address 'pentest' ticket IAP-1012): signed-out support form + chatbot handoff need an email that belongs to an account on this site; inbound email opens NEW tickets only for member emails (replies to existing tickets still land)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -4,8 +4,8 @@
|
||||
// auto-replies, bulk mail and our own messages, so two autoresponders can never ping-pong. The URL carries a secret key
|
||||
// (env SUPPORT_INBOUND_KEY); SendGrid retries anything that is not 2xx, so the route always answers 200 once the key passes.
|
||||
'use strict';
|
||||
let tickets = null;
|
||||
function init(d) { tickets = d.tickets; }
|
||||
let tickets = null, accounts = null;
|
||||
function init(d) { tickets = d.tickets; accounts = d.accounts || null; }
|
||||
const key = () => String(process.env.SUPPORT_INBOUND_KEY || '').trim();
|
||||
|
||||
// a small multipart reader: text fields only, files skipped (attachments are not kept yet)
|
||||
@@ -63,6 +63,8 @@ async function handle(buf, contentType) {
|
||||
if (plus) { const ref = plus[1].toUpperCase(); if (!subject.toUpperCase().includes(ref)) subject = '[' + ref + '] ' + subject; }
|
||||
const body = stripQuoted(f.text || htmlToText(f.html)) || '(empty message)';
|
||||
const r = await tickets.ingestEmail({ from, name: nameOf(f.from), subject, text: body, platform, confirm: true,
|
||||
// new tickets only from member emails (Marty 2026-10-24); LinkSpin-first members are InstantAdPay accounts too (lsinbound)
|
||||
canOpen: accounts ? async addr => { try { return !!(await accounts.byEmail(addr)); } catch (e) { return true; } } : null,
|
||||
messageId: header(raw, 'Message-ID'), inReplyTo: header(raw, 'In-Reply-To'), references: header(raw, 'References') });
|
||||
if (r && r.error) return 'refused: ' + r.error;
|
||||
return (r.created ? 'new ticket ' : 'reply on ') + (r.ticket && r.ticket.ref) + ' from ' + from;
|
||||
|
||||
Reference in New Issue
Block a user