-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
refactor(head-analytics): migrate php code to an action, add coverage #2974
Merged
wescopeland
merged 6 commits into
RetroAchievements:master
from
wescopeland:head-analytics-action
Jan 1, 2025
Merged
refactor(head-analytics): migrate php code to an action, add coverage #2974
wescopeland
merged 6 commits into
RetroAchievements:master
from
wescopeland:head-analytics-action
Jan 1, 2025
Conversation
This file contains 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
wescopeland
commented
Dec 23, 2024
Comment on lines
31
to
47
public function __construct() | ||
{ | ||
// Routes that support self-healing URLs (or will in the future) with ID lookups. | ||
$this->addModelRoute('game', Game::class, 'title'); | ||
$this->addModelRoute('achievement', Achievement::class, 'title'); | ||
$this->addModelRoute('hub', GameSet::class, 'title'); | ||
$this->addModelRoute('system', System::class, 'name'); | ||
|
||
// Routes that just use a string parameter. | ||
$this->addStringRoute('user', 'username'); | ||
|
||
// Routes that just use an ID. | ||
$this->addIdRoute('ticket'); | ||
|
||
// Routes with nested ID-slug segments. | ||
// TODO $this->addNestedRoute('forums', ['category', 'forum']); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to make this as simple as possible for adding new routes. Nested routes are not yet implemented, but some TODOs are in place.
Ideally a developer should not need to write regex to add model-bound routes. It should be a fairly trivial thing.
Jamiras
reviewed
Dec 31, 2024
Jamiras
approved these changes
Jan 1, 2025
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.
This PR migrates the URL path sanitization and props extraction code in head-analytics.blade.php to a reusable action that is also covered by tests.
Currently, there is an issue in Plausible where our self-healing system URLs are not being sanitized correctly:

This will be a recurring problem going forward as more URLs use slugs. The changes in this PR address the issue:

How to test this PR
Open your network tab and navigate to various pages. Check the "event" call. The
p
andu
parameters are the ones of interest.