mediawiki.api: Correctly handle boolean parameters
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 18 Aug 2015 17:01:34 +0000 (19:01 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 20 Aug 2015 15:46:21 +0000 (15:46 +0000)
commit334e3536b26bb5a224abb7d3c0504e663c9e1171
tree5d934296f520b971130c285c78f87e8801a1e56f
parentedda7119a8a3776eaf669780b73dddae9c89a94e
mediawiki.api: Correctly handle boolean parameters

Quoting https://www.mediawiki.org/w/api.php#main.2Fdatatypes:

    Boolean parameters work like HTML checkboxes: if the parameter is
    specified, regardless of value, it is considered true. For a false
    value, omit the parameter entirely.

Therefore, omit the parameters if the value is `false`.

The idea is adapted from MobileFrontend's api.js.

Change-Id: I596e14304951f49acc36159cb806b266117fb550
resources/src/mediawiki.api/mediawiki.api.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js