mediawiki.messagePoster: Minor code and docs clean up
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 23 Dec 2015 01:18:15 +0000 (17:18 -0800)
committerKrinkle <krinklemail@gmail.com>
Tue, 5 Jan 2016 21:55:08 +0000 (21:55 +0000)
commit144bbb321c33c2d44e34eda9722e23b25087718e
treee0653ed157fd6fe9809f9cd8545212c87a2f2d58
parent452ea3c393542d2e7d7dd7cfe241de14ab73fe6f
mediawiki.messagePoster: Minor code and docs clean up

* Improve and simpify various descriptions.

* Consistently use the imperative mood for the first line of
  method descriptions.

* create(): Refactor to be more stable and resilient.
  - Move variable declarations to inside the Deferred handler to avoid
    fragile code where data is transferred between different promise callbacks.
  - Remove check for 'result.query.pageids'. If it doesn't exist then neither
    does 'result.query' and it would throw either way.
  - Simplify check by asserting [0] directly instead of computing the length.
    Matches the actual code below.
  - Rename local variable 'errorCode' to match documentation of second param
    being 'error'. 'errorCode' is the first parameter passed to reject().
  - Outdent body and change to pattern of error-first returning.
  - Rename unexposed classname to be plain without MW prefix.

Change-Id: If642e94942abcbf7e5aa373fbd83a30d9202f24a
resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js
tests/qunit/suites/resources/mediawiki/mediawiki.messagePoster.factory.test.js