From 3fb123393afa300d917d225644d41ec8763871ad Mon Sep 17 00:00:00 2001 From: martbost Date: Thu, 17 Sep 2026 19:59:13 -0500 Subject: [PATCH] Admin credit grants carry their reason into the member's Credit activity A correction that reads 'granted by admin' explains nothing to the member looking at their ledger. The note now travels with the grant, so a credit-consumption correction names itself where they will actually see it. Co-Authored-By: Claude Opus 5 (1M context) --- server.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index e459660..44b32c9 100644 --- a/server.js +++ b/server.js @@ -1593,7 +1593,11 @@ const server = http.createServer(async (req, res) => { if (b.grantCredits !== undefined) { const n = Math.round(Number(b.grantCredits)); if (!(n > 0) || n > 100000) return json(res, 400, { error: 'Credits: a whole number from 1 to 100,000.' }); - await ads.addEarned(e, n, { log: { kind: 'grant', note: 'Credits granted by admin' } }); + // The member sees this note in their Credit activity, so let the reason travel with + // the grant. A correction that reads "granted by admin" explains nothing; one that + // names itself is the difference between a refund and a mystery (Marty, 2026-09-17). + const why = String(b.note || '').trim().slice(0, 120) || 'Credits granted by admin'; + await ads.addEarned(e, n, { log: { kind: 'grant', note: why } }); console.log('admin credits', e, n, String(b.note || '').slice(0, 100)); } return json(res, 200, await adminMember.view(e));