Admin > Email an update loads at once; audience counts fill in from the background
The panel waited on a Sendy pass over every member (minutes, and the cache empties on each deploy), so it showed blank. Counts are now a snapshot with a background refresh, and the form no longer depends on them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -1934,7 +1934,7 @@ 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, draft: updates.draft() }, 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: updates.countsSnapshot(), 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' });
|
||||
|
||||
Reference in New Issue
Block a user