Member labels: resolve a brand-new buyer by on-chain wallet so purchase emails name the username, not member #
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -519,7 +519,11 @@ async function notifyNewReferral(ref, newAcct) {
|
|||||||
// how a member is named in emails/alerts: @username, a linked position named after its owner, else member #id
|
// how a member is named in emails/alerts: @username, a linked position named after its owner, else member #id
|
||||||
async function memberLabel(id) {
|
async function memberLabel(id) {
|
||||||
try {
|
try {
|
||||||
const a = await accounts.byMemberId(id);
|
let a = await accounts.byMemberId(id);
|
||||||
|
if (!a) { // brand-new buyer: the account learns its member id on its next page load, so read the
|
||||||
|
// wallet from the chain and match it now (Jim's purchase mailed as "member #25", 2026-09-13)
|
||||||
|
try { const m = await chain.member(id); if (m && m.account) { a = await accounts.byAddress(String(m.account).toLowerCase()); if (a && !a.memberId) accounts.setMemberId(a.email, id).catch(() => {}); } } catch (e) {}
|
||||||
|
}
|
||||||
if (a && a.username) return '@' + a.username;
|
if (a && a.username) return '@' + a.username;
|
||||||
const pos = await accounts.positionByMember(id);
|
const pos = await accounts.positionByMember(id);
|
||||||
if (pos && pos.email) { const o = await accounts.byEmail(pos.email); if (o && o.username) return '@' + o.username + ' (extra position #' + id + ')'; }
|
if (pos && pos.email) { const o = await accounts.byEmail(pos.email); if (o && o.username) return '@' + o.username + ' (extra position #' + id + ')'; }
|
||||||
|
|||||||
Reference in New Issue
Block a user