Fix: update request for an older version than the latest (1.47.4)
After asking for an update, a newer version coming out made the Licence page claim the newer version was requested, with no way to ask for it. Now it shows the version asked for, that a newer one is out, and "Ask for X instead"; the banner shows again. Hub 1.5.0 moves the open request on (`changed`); with an older Hub the site withdraws and asks again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "hope-events-frontend",
|
||||
"version": "1.47.3",
|
||||
"version": "1.47.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "hope-events-frontend",
|
||||
"version": "1.47.3",
|
||||
"version": "1.47.4",
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@hookform/resolvers": "^5.2.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hope-events-frontend",
|
||||
"version": "1.47.3",
|
||||
"version": "1.47.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
|
||||
@@ -24,7 +24,8 @@ export type HubStatus = {
|
||||
urgentUpdate: boolean;
|
||||
updateSnoozed: boolean;
|
||||
releases: HubRelease[];
|
||||
updateRequest: { requestedAt: string; version: string } | null;
|
||||
// `outdated`: a newer version than the one asked for is out (the request can be changed to it).
|
||||
updateRequest: { requestedAt: string; version: string; outdated?: boolean } | null;
|
||||
notices: HubNotice[];
|
||||
};
|
||||
|
||||
@@ -138,6 +139,8 @@ export function LicenceTab({ active }: { active: boolean }) {
|
||||
}
|
||||
};
|
||||
const requestUpdate = () => updateAction("/api/hub/update-request", undefined, "Update requested. Your provider has been told and will update the site.");
|
||||
// Same request again: the Hub moves the open request on to the latest version.
|
||||
const changeRequest = () => updateAction("/api/hub/update-request", undefined, `Request changed to version ${status?.latestVersion}. Your provider has been told.`);
|
||||
const withdrawRequest = () => {
|
||||
if (!confirm("Withdraw the update request? Your provider is told not to update the site for now.")) return;
|
||||
updateAction("/api/hub/update-request/cancel", undefined, "Update request withdrawn. Your provider has been told.");
|
||||
@@ -208,12 +211,26 @@ export function LicenceTab({ active }: { active: boolean }) {
|
||||
</p>
|
||||
)}
|
||||
{status.updateRequest ? (
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<p className="text-gray-600">Version {status.latestVersion} is available. Update requested on {fmt(status.updateRequest.requestedAt)} — your provider will install it.</p>
|
||||
{status.connected && (
|
||||
<button onClick={withdrawRequest} disabled={busy} className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-sm hover:bg-gray-50 disabled:opacity-50">
|
||||
<Undo2 className="w-4 h-4" /> Withdraw request
|
||||
</button>
|
||||
<div className="space-y-2" data-testid="update-request">
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<p className="text-gray-600">
|
||||
You asked for version <strong>{status.updateRequest.version}</strong> on {fmt(status.updateRequest.requestedAt)} — your provider will install it.
|
||||
</p>
|
||||
{status.connected && (
|
||||
<button onClick={withdrawRequest} disabled={busy} className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-sm hover:bg-gray-50 disabled:opacity-50">
|
||||
<Undo2 className="w-4 h-4" /> Withdraw request
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{status.updateRequest.outdated && (
|
||||
<div className="flex flex-wrap items-center gap-3 rounded-lg border border-brand-200 bg-brand-50 p-3">
|
||||
<p className="text-brand-800">Version <strong>{status.latestVersion}</strong> has come out since. Ask for it instead, and your provider installs that one.</p>
|
||||
{status.connected && (
|
||||
<button onClick={changeRequest} disabled={busy} className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-white text-sm font-medium hover:bg-brand-700 disabled:opacity-50">
|
||||
<ArrowUpCircle className="w-4 h-4" /> {busy ? "Working…" : `Ask for ${status.latestVersion} instead`}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -52,17 +52,21 @@ export function LicenceBanner() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// Once an update has been requested there's nothing more for the admin to do. "Not now" hides it
|
||||
// until the next version, except for urgent (security or serious bug) updates.
|
||||
if (status.urgentUpdate && !status.updateRequest) {
|
||||
// Once the latest version has been requested there's nothing more for the admin to do. A request
|
||||
// for a version that has since been overtaken shows again, to change it. "Not now" hides it until
|
||||
// the next version, except for urgent (security or serious bug) updates.
|
||||
const request = status.updateRequest;
|
||||
const awaiting = !!request && !request.outdated;
|
||||
const ask = request?.outdated ? <>You asked for {request.version}; change your request in {link}</> : <>Please request the update in {link}</>;
|
||||
if (status.urgentUpdate && !awaiting) {
|
||||
return (
|
||||
<div role="alert" className="bg-red-50 border-b border-red-200 text-red-800 text-sm px-4 py-2 flex items-center gap-2">
|
||||
<ShieldAlert className="w-4 h-4 shrink-0" />
|
||||
<span>Cross Events {status.latestVersion} fixes a security problem or a serious bug (this site runs {status.version}). Please request the update in {link}</span>
|
||||
<span>Cross Events {status.latestVersion} fixes a security problem or a serious bug (this site runs {status.version}). {ask}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (status.updateAvailable && !status.updateRequest && !status.updateSnoozed) {
|
||||
if (status.updateAvailable && !awaiting && !status.updateSnoozed) {
|
||||
const notNow = async () => {
|
||||
setBusy(true);
|
||||
try { setStatus(await apiFetch<HubStatus>("/api/hub/update-snooze", { method: "POST", authToken: token, body: { snooze: true } })); } catch { /* the Licence page shows why */ }
|
||||
@@ -72,7 +76,7 @@ export function LicenceBanner() {
|
||||
<div role="status" className="bg-brand-50 border-b border-brand-100 text-brand-800 text-sm px-4 py-2 flex flex-wrap items-center gap-x-3 gap-y-1">
|
||||
<span className="flex items-center gap-2">
|
||||
<ArrowUpCircle className="w-4 h-4 shrink-0" />
|
||||
<span>Cross Events {status.latestVersion} is available (this site runs {status.version}). See what's new and request it in {link}</span>
|
||||
<span>Cross Events {status.latestVersion} is available (this site runs {status.version}). {request?.outdated ? <>You asked for {request.version}; see what's new and change your request in {link}</> : <>See what's new and request it in {link}</>}</span>
|
||||
</span>
|
||||
<button onClick={notNow} disabled={busy} className="ml-auto inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-brand-700 hover:bg-brand-100 disabled:opacity-50" title="Hide this until the next version comes out">
|
||||
<BellOff className="w-3.5 h-3.5" /> Not now
|
||||
|
||||
@@ -184,7 +184,7 @@ export const siteSettingsHelpContent: HelpContent = {
|
||||
When a licence is suspended, revoked or past its grace period, nothing new can be added — no events, registrations or payments. Tickets for events people already paid for still scan, and all data can still be viewed and exported.
|
||||
</GuideItem>
|
||||
<GuideItem icon={ArrowUpCircle} title="Updates" tone="brand">
|
||||
When a new version is out, the Version box shows what's new in it, so you can decide whether you want it. Press Request update and your provider updates the site for you — there's nothing to run yourself. Changed your mind? Withdraw request tells your provider not to.
|
||||
When a new version is out, the Version box shows what's new in it, so you can decide whether you want it. Press Request update and your provider updates the site for you — there's nothing to run yourself. Changed your mind? Withdraw request tells your provider not to. If a newer version comes out before your provider has updated the site, the page shows which version you asked for and offers "Ask for … instead".
|
||||
</GuideItem>
|
||||
<GuideItem icon={BellOff} title="Not now" tone="gray">
|
||||
Not now (on the Licence page or the update banner) hides the reminder until the next version comes out. Updates that fix a security problem or a serious bug can't be put off.
|
||||
|
||||
Reference in New Issue
Block a user