Admin Member content pane: every page, link, source, zone, ad, postback, upload, profile, broadcast, audience and video members made, in one list

- GET /api/admin/content?type=&q=&from=&to=&flagged=1&page=&per=&fresh=1 (admin only, read-only): content.js normalizes
  rows from each module's own adminAll() (new one-pass accessors in pages, rotator, sources, zones, postbacks,
  audiences, messages.adminBroadcasts, videomaker.adminJobs) plus ads.adminList and accounts.listAll; owner shown as
  @username, email and member #; created in Central time; totals per type; busiest hosts in the current view
- Flags: open member reports on an ad, dead or parked destinations, burned link domains, failing postbacks,
  admin-paused zones, home-page demo links. No deny list exists yet
- Row actions only reuse existing moderation routes (campaign pause/resume, zone pause/resume); "Open member" jumps
  to the member card; page Preview works for drafts and is never counted (admin allowed on ?preview=1)
- Uploads: /uploads files now recorded with their uploader in uploads-index.json; older files get the owner from
  whatever uses them (campaign creative, profile, wall offer)
- Credits > Your purchases: buys made from linked positions are included, labelled "Position N"
- Cache tags: admin.css 20261018a, admin.js 20261018b, credits-screen.js 20261018b

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-18 07:01:58 -05:00
parent f4b3058a58
commit afede88c4a
15 changed files with 464 additions and 16 deletions
+13 -1
View File
@@ -197,5 +197,17 @@ async function reclassifyCarryNotices(fromEmail) {
if (n) J.save();
return n;
}
module.exports = { init, lastFrom, lastBroadcastAt, deliver, inbox, unreadCount, newestUnread, markRead,
// admin Member content (2026-10-18): the broadcasts members wrote, one row per send (deliver() stores one row per recipient).
// Human broadcasts only: system notices / alerts and the private 1:1 chats are left out.
async function adminBroadcasts(limit) {
const lim = Math.max(1, Math.min(5000, Number(limit) || 2000));
if (db.enabled()) {
const rows = await db.q("SELECT from_member, from_email, subject, MAX(body) body, sent, COUNT(*) n FROM sponsor_messages WHERE (kind='broadcast' OR kind IS NULL) GROUP BY from_member, from_email, subject, sent ORDER BY sent DESC LIMIT ?", [lim]);
return rows.map(r => ({ fromMember: Number(r.from_member) || 0, fromEmail: String(r.from_email || '').toLowerCase(), subject: r.subject || '', body: String(r.body || ''), sent: Number(r.sent) || 0, recipients: Number(r.n) || 0 }));
}
if (!J.db) J.load(); const g = new Map();
for (const i of J.db.items) { if ((i.kind || 'broadcast') !== 'broadcast') continue; const k = (i.fromEmail || '') + '\u0000' + (i.subject || '') + '\u0000' + i.sent; const o = g.get(k); if (o) o.recipients++; else g.set(k, { fromMember: Number(i.fromMember) || 0, fromEmail: String(i.fromEmail || '').toLowerCase(), subject: i.subject || '', body: String(i.body || ''), sent: i.sent || 0, recipients: 1 }); }
return Array.from(g.values()).sort((a, b) => b.sent - a.sent).slice(0, lim);
}
module.exports = { init, adminBroadcasts, lastFrom, lastBroadcastAt, deliver, inbox, unreadCount, newestUnread, markRead,
sendChat, thread, markChatRead, chatUnread, threadList, reclassifyCarryNotices };