fix: #3631761 Avoid building the alias link when verbose messages are off.

Summary

AliasStorageHelper::save() built and rendered a link to the new alias for every "Created new URL alias" message, then passed it to VerboseMessenger, which drops it unless verbose messages are on. Verbose is off by default, so on most sites every alias save resolved a URL and rendered a link that nobody saw. This adds VerboseMessengerInterface::isVerbose(), and save() now checks it before building the message. MessengerInterface is unchanged, and any other implementation of it keeps the current behavior.

AliasStorageHelperTest now enables verbose messages for the two save-order tests from #3608478, which only passed because the link was always built. A new test asserts that the path validator is never called when verbose is off. Without the fix, that test fails with getUrlIfValidWithoutAccessCheck('pathauto-not-verbose-test') was not expected to be called.

AI disclosure

Claude Code was used to draft this description; reviewed and tested by a human.

Testing

  • Add a Pathauto pattern for a content type, keep Verbose off (default), and save 200 aliases (drush php:script with the path validator wrapped to count calls) → 200 URL resolutions, no messages
  • Apply this MR, drush cr
  • Repeat → 0 URL resolutions, no messages, save() about 2× faster
  • Enable Verbose and create a node as a user with notify of path changes → "Created new URL alias …" still shows and links to the alias
  • VerboseMessengerTest, AliasStorageHelperTest, PathautoKernelTest, PathautoSettingsFormWebTest and PathautoNodeWebTest pass

Merge request reports

Loading
Loading