Page MenuHomePhabricator

Small improvement in documentation of mw.util.addPortletLink()
Closed, ResolvedPublic

Description

In documentation of the mw.util.addPortletLink() method, we may replace :

new mw.Title( 'Special:Example' ).getUrl()

with:

mw.util.getUrl( 'Special:Example' )

Rationale:

  • It is simpler and more usual.
  • As it is inside a mw.util.addPortletLink(), the mediawiki.util dependency should be already taken care of, whereas using mw.Title() requires adding the mediawiki.Title dependency (and my guess is that it is often overlooked).
  • titleObject.getUrl() just calls mw.util.getUrl() internally.

Event Timeline

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

Source file is resources/src/mediawiki.util/util.js in the mediawiki/core code repository in Gerrit.

Frostly triaged this task as High priority.
Frostly added a project: User-Frostly.

Change 952545 had a related patch set uploaded (by Gerrit Patch Uploader; author: Anne Haunime):

[mediawiki/core@master] Use mw.util.getUrl() in documentation of mw.util.addPortletLink()

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

Od1n lowered the priority of this task from High to Low.Aug 27 2023, 4:44 AM
Od1n updated the task description. (Show Details)

@Frostly I have submitted a patch for this, but feel free to work on this too if you want to learn the tools :)

Frostly subscribed.

Ah, thanks for the heads-up!

Change 952545 merged by jenkins-bot:

[mediawiki/core@master] Use mw.util.getUrl() in documentation of mw.util.addPortletLink()

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