Banners reach a site the Hub installed
Found in the VM test: a Hub-installed site registers with its licence key, but its deployment was never linked to that registration, so update and closing banners were silently skipped. Registration now makes the link, and a notice makes it for sites that registered before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls1vMdni7EfytGYqQTprME
This commit is contained in:
@@ -324,8 +324,17 @@ async function fastPanelText(d) {
|
||||
// ─── Notices (banners) ────────────────────────────────────────────────────────
|
||||
|
||||
async function addNotice(deployment, { title, message, endsAt, level = 'maintenance' }, now) {
|
||||
if (!deployment.installId) return null;
|
||||
const n = await prisma.notice.create({ data: { title, message, level, allInstalls: false, installIds: [deployment.installId], showBanner: true, startsAt: now, endsAt } });
|
||||
let installId = deployment.installId;
|
||||
// Registered before registration made the link (Hub 2.1.0 builds before the VM test).
|
||||
if (!installId && deployment.licenceId) {
|
||||
const install = await prisma.install.findFirst({ where: { licenceId: deployment.licenceId } });
|
||||
if (install) {
|
||||
installId = install.id;
|
||||
await prisma.deployment.update({ where: { id: deployment.id }, data: { installId } }).catch(() => {});
|
||||
}
|
||||
}
|
||||
if (!installId) return null;
|
||||
const n = await prisma.notice.create({ data: { title, message, level, allInstalls: false, installIds: [installId], showBanner: true, startsAt: now, endsAt } });
|
||||
return n.id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user