Last modified: 2014-02-05 09:17:23 UTC
From Krinkle's comment, on bug 34733 comment 6: ---- It [the function "postWithEditToken"] doesn't edit a page by default, it's used as a pre-processor basically to either continue or get an edit token first. You still need to set action=edit in the params (or something else). Looks like an mw.Api.prototype.edit function should be created separate from this that'll call it with action=edit. Not related to this bug [bug 34733] though, create a new enhancement bug for it and a patch if you like :) ----
Yes, though it doens't make sense to create a separate resourceloader module for every possible value of the "action" parameter. Certain actions have dedicated modules to abstract certain logic. It isn't just for the purpose of specifying the action. mw.Api#post is not an internal method in anyway, so there's nothing wrong with: mw.Api#post({ action: foo, param: example }); Creating a module for it only changes it to: mw.Api#foo({ param: example }); At the cost of having to specify a dependency on mediawiki.api.foo and the extra code being downloaded, executed and increasing the function call stack (user > foo > post > ajax > jquery.ajax > ...). Unless this proposed module would do something useful beyond just passing through the parameters and tacking .action = foo on it, recommending closing as WONTFIX.
Was added with r105646
(In reply to comment #2) > Was added with r105646 Not really. The module "mediawiki.api.edit" introduced on r105646 is the one I was talking about on bug 34733 comment 3: > do the function name "postWithEditToken" need to contain the word "Token"? > Wouldn't be more intuitive if the user didn't have to write that when using > the API to edit a page? E.g. api.edit( params, ok, err )? > > One more question: is this module new in MW 1.19? If so, and in the case the > function name will change, could this change be backported to MW 1.19?
I'm not sure what the request is here. There is both a way to use action=edit (mediawiki.api.edit), which already existed since 1.18.1. And an abstract interface to post with tokens exists as well (and edit token is even available already through mw.user.tokens now). This bug seems obsolete.
That is missing here is the part about having a simple name such as "edit" instead of the obscure "postWithEditToken": api.edit( params ).done( fn ).fail( err ) Compare with the simplicity of "watch" and "unwatch".