main ← feature-reason-badge-workflow
Requested here: https://meta.discourse.org/t/include-reason-in-grant-badge-disco…urse-action-in-workflows/417202
Previously, badges granted by a workflow could not be linked to a post or topic, unlike grants made from the admin UI.
<img width="630" height="216" alt="image" src="https://github.com/user-attachments/assets/77c0b5e4-998f-4eb6-ae8e-984152eaf317" />
This change adds an optional `reason` field to the badge node. It accepts a post or topic URL, or a prefixed `post:123` / `topic:123` ID, and is hidden for system badges whose posts are never shown.
To support this, the reason-URL parsing moves from `UserBadgesController` into `BadgeGranter.post_for_reason`, so the admin grant form now also links `/p/…` and `/posts/…` URLs to their post. A new `metadata_flag` display condition hides fields based on flags in a node's option data, in both the editor and the server.