mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Bring up the migration where somebody runs into it
Taking back a site had one way in: a button in Settings under Deploy, which said the same thing to everybody and could not say whether anything was actually waiting. On the gateway this was built for, two people out of eight hundred and seven have used it. The moment it is needed is the one somebody types a name they used to own, and until now that moment did the opposite — the name came back taken and the button went dead, because a name being held for its previous owner looks exactly like a stranger's to anyone who does not ask. The gateway can now be asked, so the field says the name is being held for them and offers the step that gets it back, in place of a refusal with nowhere to go. The deploy dialog owns that list rather than the field, because one recognised name is rarely all somebody has waiting. npanel also refuses to add a name it is holding, saying to take it back instead — a sentence that was being shown as a flat red alert with no way to act on it. That refusal now carries the same offer. And the settings card asks how many are waiting instead of guessing. It costs a signature on a page nobody asked to sign on, which is the thing this deliberately did not do before; the difference is that it is now two counted rows rather than a read of every claimed deploy, and that the card says nothing at all unless there is something to say. A card that cannot tell whether it applies to you is one most people learn to ignore before it ever does.
This commit is contained in:
8 files changed
+334
-26
No files matched your search
@@ -17,7 +17,8 @@ import { useNostrPublish } from '@/hooks/useNostrPublish';
|
||||
import { useGit } from '@/hooks/useGit';
|
||||
import { NostrURI } from '@/lib/NostrURI';
|
||||
import { Link } from 'react-router-dom';
|
||||
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
||||
import type { DeployProvider, NpanelProvider } from '@/contexts/DeploySettingsContext';
|
||||
import { NpanelMigrationDialog } from '@/components/deploy/NpanelMigrationDialog';
|
||||
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
||||
import { PRESET_DEPLOY_PROVIDERS } from '@/lib/deployProviderPresets';
|
||||
import { NpanelDeployForm } from '@/components/deploy/NpanelDeployForm';
|
||||
@@ -154,6 +155,24 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
const [deployResult, setDeployResult] = useState<{ url: string } | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [isNpanelFormValid, setIsNpanelFormValid] = useState(true);
|
||||
/**
|
||||
* The gateway whose held names are being looked at, if any.
|
||||
*
|
||||
* Owned here rather than by the name field, because what someone recognising
|
||||
* one of their names wants is usually all of them, and because the dialog
|
||||
* that hands them back outlives the field that prompted it.
|
||||
*/
|
||||
const [migratingProvider, setMigratingProvider] = useState<NpanelProvider | null>(null);
|
||||
|
||||
/**
|
||||
* Whether the deploy failed because the gateway is holding the name for this
|
||||
* user, which is a refusal with something to do about it.
|
||||
*
|
||||
* Read off the sentence npanel sent rather than a status code, since the 409
|
||||
* it arrives as also covers a name somebody else holds and a name that is
|
||||
* simply configured already.
|
||||
*/
|
||||
const heldName = error !== null && /being held for you/i.test(error);
|
||||
|
||||
// .nsite/config.json state — loaded once on mount, used to skip config form on re-deploy
|
||||
const [nsiteVfsConfig, setNsiteVfsConfig] = useState<NsiteVfsConfig | null>(null);
|
||||
@@ -627,6 +646,7 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
onSiteTitleChange={handleNpanelSiteTitleChange}
|
||||
onSiteDescriptionChange={handleNpanelSiteDescriptionChange}
|
||||
onValidationChange={handleNpanelValidationChange}
|
||||
onTakeBackSites={() => setMigratingProvider(npanelProvider)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -978,7 +998,22 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
<AlertDescription className="space-y-2">
|
||||
<p>{error}</p>
|
||||
{/* The gateway refuses a name it is holding for this user
|
||||
and says to take it back instead. Saying so and leaving
|
||||
them to find out where is the worst of both. */}
|
||||
{heldName && selectedProvider?.type === 'npanel' && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setMigratingProvider(selectedProvider)}
|
||||
>
|
||||
Take back your sites
|
||||
</Button>
|
||||
)}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
@@ -1015,6 +1050,14 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{migratingProvider && (
|
||||
<NpanelMigrationDialog
|
||||
open
|
||||
onOpenChange={(open) => !open && setMigratingProvider(null)}
|
||||
provider={migratingProvider}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user