Page MenuHomePhabricator

action=watch parses message using "API" instead of the page being watched or unwatched
Closed, ResolvedPublic

Description

Patch to set $wgTitle so action=watch parses messages correctly.

The API's action=watch parses MediaWiki:Addedwatchtext or MediaWiki:Removedwatchtext (as appropriate) and returns it as "message" in the response. However, when these messages are parsed they are parsed with the current page set to "API" rather than the page being watched or unwatched, which means that magic words such as {{NAMESPACE}} or {{TALKSPACE}} will return the wrong value. [[en:MediaWiki:Addedwatchtext]], for example, uses these magic words to provide a better response to the user when watch is used on a talk page.

The problem seems easy enough to fix: since wfMsgExt doesn't pass a title, MessageCache uses $wgTitle. So if we just set $wgTitle appropriately from the API's watch module, everything works as it should.

As a workaround, affected wikis can use {{NAMESPACE:$1}} and the like in their messages.


Version: 1.20.x
Severity: normal

Attached:

Details

Reference
bz34377

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:12 AM
bzimport set Reference to bz34377.
bzimport added a subscriber: Unknown Object (MLST).

Fixed in r111397 and r111398.

(In reply to comment #1)

Fixed in r111397 and r111398.

Yay, better fix without using $wgTitle! :D