Page MenuHomePhabricator

Expose disambiguation property (ppprop=disambiguation) in mobileview api
Closed, ResolvedPublic

Description

We want to flag whether pages are disambiguation pages.

Currently the mobile content service uses the MobileViewApi

Acceptance criteria

Developer notes

Forwarding happens here:
https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/includes/api/ApiMobileView.php#L146

Related Objects

StatusAssignedTask
OpenNone
OpenNone
ResolvedJhernandez
ResolvedMholloway
DuplicateNone
OpenNone
ResolvedDereckson
ResolvedJdlrobson
Resolvedovasileva
DuplicateNone
DeclinedNone
ResolvedNirzar
Resolvedovasileva
ResolvedJdlrobson
DuplicateNone
DuplicateNone
Resolvedovasileva
OpenJdlrobson
ResolvedJdlrobson
Resolvedovasileva
ResolvedJdlrobson
Resolvedphuedx

Event Timeline

phuedx closed this task as Resolved.Jul 20 2017, 11:02 AM
phuedx claimed this task.

After a little investigation, this is already done.

The mobileview API can accept prop=pageprops parameter, which'll make it mix in the request page properties to the response. Adding pageprops=disambiguation to the query parameters does indeed expose the property just as the Disambiguator API does.

Compare:

https://en.wikipedia.org/wiki/Special:ApiSandbox#action=mobileview&format=json&page=Barack_(disambiguation)&prop=pageprops&pageprops=disambiguation

{
    "mobileview": {
        "pageprops": {
            "disambiguation": ""
        },
        "sections": []
    }
}

with https://en.wikipedia.org/wiki/Special:ApiSandbox#action=mobileview&format=json&page=Barack_Obama&prop=pageprops&pageprops=disambiguation

{
    "mobileview": {
        "pageprops": {},
        "sections": []
    }
}

Now, if the Disambiguator extension isn't installed, then the disambiguation page property won't exist. Fortunately, the mobileview API seems to silently ignore undefined page properties, e.g. https://en.wikipedia.org/wiki/Special:ApiSandbox#action=mobileview&format=json&page=Barack_Obama&prop=pageprops&pageprops=foo