Repository navigation
Fixes #37191: Use the two-argument buildEntityUrl example - #37194
Conversation
Code Review ✅ Approved🟡 Medium risk · Updating the buildEntityUrl example and helper cursor offsets affects notification links and editor insertion; incorrect metadata could leave copied templates broken. Corrects the VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Fixes #37191
Problem
The
buildEntityUrltemplate helper needs two arguments: the entity type and the entity. Two places still showed a one-argument example,{{buildEntityUrl entity}}:GET /v1/notificationTemplates/helpers, which returns an example for each helper;With one argument the helper has no entity type to build the path from, so it renders an empty string. Anyone who copies the example gets notifications with an empty link.
What this PR changes
{{buildEntityUrl event.entityType entity}}as the example. This is the same form the system templates and the published docs already use.Cursor position for six helpers
The same API also tells the template editor where to put the cursor after it inserts a helper. For most helpers that position is right after the helper name, ready for the first argument. Six helpers were one character off:
formatDate,math,length,textDiff,resolveDomainandrenderTableSample. The cursor landed inside the closing braces.The Collate template editor is starting to read its helper list from this API (collate#8309), so these positions now matter. This PR corrects the six and adds a test that checks the position for every helper the server registers. Before the fix, the test fails for exactly these six.
How it was tested
HandlebarsHelperMetadataTest,BuildEntityUrlHelperTest,NotificationTemplateHelperCoreTest,NotificationTemplateHelperAdvancedTestandSystemTemplateParityTest: 74 tests, all passing.In the browser, on a local stack running this branch:
{{buildEntityUrl event.entityType entity}}in both places.{{formatDate event.timestamp}}.Screenshots
The "before" column is the commit this PR is based on, with the Collate editor from collate#8309, because only that editor uses these values.
Both examples showed the one-argument call, which renders an empty link. They now show the two-argument call.
{{listThe example from the helpers API had the same one-argument call. It now shows the two-argument call.
formatDatepicked, then its argument typedThe cursor landed inside the closing braces, so the argument ended up after a
}. It now lands right after the helper name.