Last modified: 2014-02-05 09:17:23 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T36744, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 34744 - Create mediawiki.api.edit module to abstract API action=edit
Create mediawiki.api.edit module to abstract API action=edit
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.19
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: javascript
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-26 19:45 UTC by Helder
Modified: 2014-02-05 09:17 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Helder 2012-02-26 19:45: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 :)
----
Comment 1 Krinkle 2013-03-19 19:56:50 UTC
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.
Comment 2 db [inactive,noenotif] 2013-11-18 19:13:34 UTC
Was added with r105646
Comment 3 Helder 2013-11-18 21:12:37 UTC
(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?
Comment 4 Krinkle 2014-02-05 04:09:42 UTC
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.
Comment 5 Helder 2014-02-05 09:17:23 UTC
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".

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links