Skip to content

Remove the license from the site even when deactivation fails - #1683

Merged
jakejackson1 merged 1 commit into
hot-patch-6.16.0from
fix/license-deactivation-clear-on-failure
Jul 24, 2026
Merged

Remove the license from the site even when deactivation fails#1683
jakejackson1 merged 1 commit into
hot-patch-6.16.0from
fix/license-deactivation-clear-on-failure

Conversation

@jakejackson1

Copy link
Copy Markdown
Member

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:

/* Remove license data from database, no matter if the API request fails */
$this->delete_license_info();
$this->flush_update_cache();

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:

Response Fields cleared Button removed Message
{success} green, from server
{error} (API rejected) red, from server
jqXHR (500 / 401) red, GFPDF.licenseDeactivationError

The extra teardown for All Access Pass siblings still runs on success only — process_license_deactivation() only populates that list once the API confirms deactivation.

licenseDeactivationError is reworded 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 reload and retry.

Kept from #1682: the red-vs-green styling fix (genuine {error} responses were previously given the success class) 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

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>
@jakejackson1
jakejackson1 merged commit e64780a into hot-patch-6.16.0 Jul 24, 2026
5 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant