Member updates: saved draft (loads into the admin card, Save draft button)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -1333,7 +1333,11 @@ const server = http.createServer(async (req, res) => {
|
||||
if (p === '/api/admin/updates' && req.method === 'GET') { // member update emails: notes, audiences, log
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const since = updates.lastSentAt();
|
||||
return json(res, 200, Object.assign({ notes: releases.notes().map(n => ({ id: n.id, title: n.title, date: n.date, fresh: !since || (n.created || 0) > since || (n.date && new Date(n.date + 'T12:00:00Z').getTime() > since) })), audiences: updates.AUDIENCES, counts: await updates.counts(), mailer: mailer.hasKey(), lastSentAt: since }, updates.status()));
|
||||
return json(res, 200, Object.assign({ notes: releases.notes().map(n => ({ id: n.id, title: n.title, date: n.date, fresh: !since || (n.created || 0) > since || (n.date && new Date(n.date + 'T12:00:00Z').getTime() > since) })), audiences: updates.AUDIENCES, counts: await updates.counts(), mailer: mailer.hasKey(), lastSentAt: since, draft: updates.draft() }, updates.status()));
|
||||
}
|
||||
if (p === '/api/admin/updates/draft' && req.method === 'POST') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
return json(res, 200, { ok: true, draft: updates.saveDraft(await readBody(req)) });
|
||||
}
|
||||
if (p === '/api/admin/updates/preview' && req.method === 'POST') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
|
||||
Reference in New Issue
Block a user