Skip to content

Only add Craft events if the API key is set - #63

Open
jamie-s-white wants to merge 1 commit into
craftpulse:v5from
supercool:feature/only-add-events-if-configured
Open

Only add Craft events if the API key is set#63
jamie-s-white wants to merge 1 commit into
craftpulse:v5from
supercool:feature/only-add-events-if-configured

Conversation

@jamie-s-white

@jamie-s-white jamie-s-white commented Jun 18, 2025

Copy link
Copy Markdown

When we first install this plugin, if we try and save elements before we have fully configured the plugin, then the save event will error:

Screenshot 2025-06-18 at 10 57 28

This PR avoids this scenario by checking that an API key has been set before it adds the Typesense events to elements.

michtio pushed a commit that referenced this pull request Jul 14, 2026
Backlog closure sweep, the full docs pass, and the final static-analysis ramp.

Quality (the contractual ZERO gate):
- PHPStan level 6 -> 8 with the baseline kept empty; every source file passes L8.
- ECS skip list emptied (Typesense.php, config.php, the synonyms migration
  cleaned to house standard); ECS clean across src and tests.
- Deleted the dead Vue-era control-panel apparatus that was holding untyped,
  orphaned code: the src/web/assets Vue/TS sources and dist output, the
  TypesenseAsset and TypesenseUtilityAsset bundles, and the Vite plugin service
  wiring in PluginTrait/TypesenseVariable. Nothing rendered them after the
  Collections and Synonyms screens were retired.
- Rewrote PluginTrait to house standard with typed, documented component getters.
- Modernised the shipped src/config.php from the legacy shim shape to the fluent
  builder (null-safe transform).

Regression tests (the three damning themes + one):
- #68 CP action URLs are CP-based, never the site URL (unit, UrlHelper::actionUrl).
- #63 saving before configuration is a safe no-op.
- #67 applying a draft skips cleanly instead of fataling.
- #65/#66 one element indexes into every collection whose query matches it.

Docs:
- Completed docs/ for the whole Free surface: multisite, drift, backup, and
  extension events for plugin authors. Rewrote the README for 5.9.0 (Free/Pro
  split, server floor v28 and refused 30.0/30.1, quick start).

Backlog sweep recorded in smoke-testing/p7-issue-sweep.md (local, nothing posted):
7 issues and 8 PRs dispositioned, 6 pinned by tests. Search bug fixed along the
way: Search now resolves the site-aware target so collectionPerSite front-end
searches hit the right collection.
michtio pushed a commit that referenced this pull request Jul 16, 2026
Wrap the element event registration (and the delete event) so they only bind
when an API key is configured, avoiding a save-time error on a fresh install
before the plugin is set up.

Adapted from the original PR to fit the current codebase: the API-key guard now
wraps the cockpit-aware element filtering (Entry plus the cockpit element types)
that postdates the PR, and keeps the null-entry guard on the restore/move
re-query, rather than the PR's plain instanceof Entry check which would have
regressed cockpit element support.

Authored-by preserved from PR #63.
michtio pushed a commit that referenced this pull request Jul 16, 2026
Document the 5.8.4 round: the forward-compatibility namespace alias and the
5.9.0 namespace-move heads-up, the batched document sync rework (#70, resolves
null entry (#67), .all-collection deletes (#64), events before configuration
(#63), and the control-panel action URL / CRAFT_BASE_CP_URL confirmation (#68).
Credits @timkelty, @jamie-s-white, @mikeymeister, and @vardumper.
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