Page MenuHomePhabricator

Convert MWGrants to a service with dependency injection
Open, Needs TriagePublic

Description

Similar to how MWNamespace was replaced with a NamespaceInfo service, I propose that MWGrants be replaced with a GrantsInfo service.

The different static MWGrants methods use:

  • The LanguageFactory service
  • The LinkRenderer service
  • The ContentLanguage service (which is just the LanguageFactory with the LanguageCode config value)
  • wgGrantPermissions
  • wgGrantPermissionGroups

The services can be injected to the new GrantsInfo class, as well as a ServiceOptions object with the needed configuration values

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Pchelolo added a subscriber: Pchelolo.

Makes sense to me. The getGrantsLink and getGrantsWikiText are quite a bit more UI-related, so it would be interesting to think if we could put them elsewhere.

getGrantsWikiText is only used in OAuth extension special pages, so we could maybe just move this code in there, perhaps in a trait used in both special pages.

getGrantsLink is more tricky, but we can maybe find it a better home too. Not sure where yet.