Remove the license from the site even when deactivation fails - #1683
Merged
jakejackson1 merged 1 commit intoJul 24, 2026
Merged
Conversation
Helper_Abstract_Addon::deactivate_license() deletes the local license info
before it inspects the API response ("Remove license data from database, no
matter if the API request fails"), so the key is gone from this site whether or
not GravityPDF.com accepted the deactivation.
The UI didn't match that. On an {error} response or a transport failure it kept
the key in the field and left the Deactivate button in place, implying the
license was still installed and could be retried — but a reload showed an empty
field, because the DB row had already been deleted.
All three outcomes now clear the key/message/status inputs and drop the button.
Only the message differs: the server's string on success (green) or error (red),
falling back to GFPDF.licenseDeactivationError when a 500/401 hits jQuery's
error handler with the raw jqXHR instead of our JSON envelope.
The `extra` teardown for All Access Pass siblings still runs on success only —
the endpoint only populates that list once the API confirms deactivation.
Rewords licenseDeactivationError to match the two equivalent PHP messages in
process_license_deactivation(): the user is pointed at their GravityPDF.com
account to confirm the site was unlinked, rather than told to retry.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reverts the "keep the license key on screen and allow another attempt" behaviour from #1682. A failed deactivation now still removes the key from the site.
Why
Helper_Abstract_Addon::deactivate_license()deletes the local license info before it inspects the API response:So the key is gone from this site whether or not GravityPDF.com accepted the deactivation. The UI didn't match: on an
{error}response or a transport failure it kept the key in the field and left the Deactivate button in place, implying the license was still installed and retryable — but a reload showed an empty field, because the DB row had already been deleted.What changed
All three outcomes now clear the key/message/status inputs and drop the Deactivate button. Only the message differs:
{success}{error}(API rejected)GFPDF.licenseDeactivationErrorThe
extrateardown for All Access Pass siblings still runs on success only —process_license_deactivation()only populates that list once the API confirms deactivation.licenseDeactivationErroris reworded to match the two equivalent PHP messages inprocess_license_deactivation(): the user is pointed at their GravityPDF.com account to confirm the site was unlinked, rather than told to reload and retry.Kept from #1682: the red-vs-green styling fix (genuine
{error}responses were previously given thesuccessclass) and the repeat-click guard.Note
On a 401/nonce failure the server never reaches
deactivate_license(), so the key is still in the DB and reappears on reload — the UI clears optimistically there. That's the trade-off for "remove it regardless"; the error message points the user at their account to confirm.Testing
npx jest— 58 suites / 468 tests passing. The three deactivation-path tests were updated to assert the new behaviour; eslint clean.No changelog entry (per request).
🤖 Generated with Claude Code