Add email to address release and an address hint

The release sheet gets an optional email field, prefilled from the saved
address and kept with it. A conversation suggests releasing the address
when the buyer's latest message contains words like "address" or "wo
genau" (a keyword guess, German and English, only ever a suggestion).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 20:04:10 +01:00
co-authored by Claude Sonnet 5.5
parent 8edae3ae56
commit 7348067350
6 changed files with 81 additions and 3 deletions
+15 -1
View File
@@ -246,6 +246,7 @@ var de = {
"own.anon": "Anonym, Ende-zu-Ende-verschl\xFCsselt",
"own.first": "Erste Nachricht dieser Person. Bis du antwortest, darf sie nur kurzen Text ohne Links schicken. Alles wird als reiner Text angezeigt, nie als Link.",
"own.hiddenMsg": "Ausgeblendet: Eine erste Nachricht muss kurz sein und darf keine Links enthalten.",
"own.hintAddress": "Die Person fragt m\xF6glicherweise nach der Adresse (Vermutung anhand einzelner W\xF6rter). Mit \u201EAdresse freigeben\u201C schickst du sie.",
"own.grantSent": "Adresse freigegeben bis {date}",
"own.reply": "Antwort",
"own.send": "Senden",
@@ -426,6 +427,7 @@ var en = {
"own.anon": "Anonymous, end-to-end encrypted",
"own.first": "First message from this person. Until you reply they can send short text only, no links. Everything is shown as plain text, never as a link.",
"own.hiddenMsg": "Hidden: a first message must be short and contain no links.",
"own.hintAddress": 'This person may be asking for the address (a guess based on a few words). Use "Release address" to send it.',
"own.grantSent": "Address released until {date}",
"own.reply": "Reply",
"own.send": "Send",
@@ -4690,6 +4692,7 @@ async function showOwner(listingId, thread) {
const msgBox = h("div", { class: "thread", "aria-live": "polite" });
const threadHead = h("h2", { class: "pane-title" });
const firstNote = h("p", { class: "note warn" }, t("own.first"));
const addressHint = h("p", { class: "note hint", hidden: true }, t("own.hintAddress"));
const threadPane = h("section", { class: "pane pane-thread" });
if (listingId && thread) {
append(threadPane, [
@@ -4698,6 +4701,7 @@ async function showOwner(listingId, thread) {
h("p", { class: "muted small" }, t("own.anon")),
msgBox,
firstNote,
addressHint,
composer2(listingId, thread, () => void refresh(), (opener) => openSheet(listingId, thread, opener, () => void refresh())),
deleteControl2(listingId, thread)
]);
@@ -4782,6 +4786,7 @@ async function showOwner(listingId, thread) {
clear(msgBox);
for (const m of msgs) msgBox.append(bubble2(m));
firstNote.hidden = msgs.some((m) => m.dir === "out");
addressHint.hidden = !asksForAddress(msgs);
}
function renderAll() {
renderListings();
@@ -4828,6 +4833,11 @@ async function showOwner(listingId, thread) {
};
tick2();
}
var ASKS_ADDRESS = /adress|address|anschrift|wo genau|wo liegt|wo befindet|which street|what street|where exactly|where is|where in/i;
function asksForAddress(msgs) {
const last = msgs[msgs.length - 1];
return !!last && last.dir === "in" && !last.hidden && last.type === "text" && ASKS_ADDRESS.test(last.text ?? "");
}
function bubble2(m) {
const mine2 = m.dir === "out";
const who = mine2 ? t("own.you") : t("own.buyer");
@@ -4985,6 +4995,7 @@ function openSheet(listingId, thread, opener, done) {
};
const address = h("input", { name: "address", maxlength: 300, required: true });
const phone = h("input", { name: "phone", maxlength: 40 });
const email = h("input", { name: "email", type: "email", maxlength: 120, autocomplete: "off" });
const note = h("textarea", { name: "note", rows: 2, maxlength: 1e3 });
const valid = h("select", { name: "valid" }, ...VALID_DAYS.map((d) => h("option", { value: String(d), selected: d === DEFAULT_DAYS }, d === 1 ? t("own.day") : t("own.days", { n: d }))));
const remember = h("input", { type: "checkbox", name: "remember" });
@@ -5009,12 +5020,13 @@ function openSheet(listingId, thread, opener, done) {
send.textContent = t("own.sending");
try {
if (remember.checked && (!saved || saved.address !== a)) {
await putAddress(listingId, { address: a, phone: phone.value.trim() || void 0, email: saved?.email });
await putAddress(listingId, { address: a, phone: phone.value.trim() || void 0, email: email.value.trim() || void 0 });
}
await sendReply(listingId, thread, {
type: "grant",
address: a,
phone: phone.value.trim() || void 0,
email: email.value.trim() || void 0,
note: note.value.trim() || void 0,
valid_days: Number(valid.value)
});
@@ -5030,6 +5042,7 @@ function openSheet(listingId, thread, opener, done) {
},
h("label", null, t("own.fAddress"), address),
h("label", null, t("own.fPhone"), phone),
h("label", null, t("own.fEmail"), email),
h("label", null, t("own.fNote"), note),
h("label", null, t("own.fValid"), valid),
rememberRow,
@@ -5058,6 +5071,7 @@ function openSheet(listingId, thread, opener, done) {
if (a) {
if (!address.value) address.value = a.address;
if (!phone.value && a.phone) phone.value = a.phone;
if (!email.value && a.email) email.value = a.email;
} else {
remember.checked = true;
}