Page MenuHomePhabricator

Move "templates on this page" logic out of EditPage
Open, MediumPublic

Description

ApiVisualEditor constructs on EditPage to be able to retrieve the formatted "templates on this page" list.
It should be possible to get the formatted list without using an EditPage object

While a new system is being created for retrieving the formatted list, TemplatesOnThisPageFormatter should have a factory rather than callers needing to independently provide a LinkRenderer, and the PermissionManager that is used should be injected rather than retrieved from MediaWikiServices::getInstance()

Plan:

  • Add a TemplatesOnThisPageFormatterFactory to create TemplatesOnThisPageFormatter objects
  • Add a method to the Formatter to get the list wrapped in a div with the templatesUsed class, as currently provided by EditPage::makeTemplatesOnThisPageList
  • Add a PermissionManager as an optional dependency, hard deprecate not providing it (callers should not construct the class directly, but should use the factory)
  • Replace the use of the EditPage object in ApiVisualEditor that relies on makeTemplatesOnThisPageList (use the new factory instead)
  • Deprecate EditPage::makeTemplatesOnThisPageList

Event Timeline

Change 596889 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] [EditPage] Add TemplatesOnThisPageFormatter::formatDiv and Factory

https://gerrit.wikimedia.org/r/596889

JTannerWMF added subscribers: eprodromou, JTannerWMF.

Hey @eprodromou , ping me if you need the Editing team to take a look at this

@Pchelolo @daniel would you be willing to take a look at the patch?

Aklapper removed subscribers: Pchelolo, eprodromou.

Removing task assignee due to inactivity as this open task has been assigned for more than two years. See the email sent to the task assignee on August 22nd, 2022.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome!
If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!