fix: #3634865 Check the generate permission before filtering the media add list

Issue: https://www.drupal.org/project/ai_media/issues/3634865

Without generate media with ai, /media/add?ai=1 still filtered the list and linked to Generate mode. The preprocess now ignores the query for users without the permission, so they get core's Add media list with plain links, and the list is cached per permissions.

Before: without the permission, the list is filtered and links to Generate mode.

Before

After: core's Add media list with plain links.

After

AI-Generated: Yes

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release

🤖 Generated with Claude Code

Edited by Rajab Natshah

Merge request reports

Loading
Loading