Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix block crash when Apple Maps credentials are missing. #233

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

elvismdev
Copy link

@elvismdev elvismdev commented Jan 27, 2025

Description of the Change

This PR fixes the issue where the Apple Maps block would crash when no credentials were configured instead of showing the credentials form.

Key changes:

  • Added proper credentials check before MapKit initialization
  • Ensured block transitions from loading state to credentials form when no credentials exist

Closes #232

How to test the Change

  1. Create a new post
  2. Add the Apple Maps block
  3. Verify that instead of crashing, you see the credentials form with instructions

Changelog Entry

Fixed - Block crash when no Apple Maps credentials are configured, now properly shows credentials form

Credits

Props @elvismdev

Checklist:

Copy link

@elvismdev thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?

@github-actions github-actions bot added needs:feedback This requires reporter feedback to better understand the request. needs:code-review This requires code review. and removed needs:feedback This requires reporter feedback to better understand the request. labels Jan 27, 2025
@peterwilsoncc
Copy link
Contributor

Thanks for the PR, @elvismdev

While testing the code, it appears that using the settings endpoint prevents contributors and other low privileged users from using the maps block when credentials are saved.

Develop branch PR Branch
Screenshot 2025-01-29 at 11 09 42 AM Screenshot 2025-01-29 at 11 10 17 AM

I think the check needs to be against the MapsBlockApple/v1/GetJWT endpoint API endpoint and if that returns an error we display the unauthenticated version of the block. If it returns a valid response, the authenticated version is shown.

The endpoint is registered in the file includes/rest-routes.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block crashes without apple maps credentials
2 participants