Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
API: Give block details along with errors | mediawiki/core | master | +92 -19 |
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | • Deskana | T75616 Tracking: API/backend issues blocking Wikipedia app development | |||
Duplicate | None | T95752 VE should give more useful message on save error due to block | |||
Resolved | Krenair | T95072 API blocked error should give details - blocker, target (IP, range, user), expiry, reason, etc. |
Event Timeline
Which query you are using?
Using meta=userinfo with uiprop=blockinfo should give some of that information. (Target seems missing.)
Or you are talking about the error 'blockedtext' coming from the api when using some write action as action=edit?
Chances are that the "blocked" errors aren't even coming from the API directly, but rather are coming from the underlying core MediaWiki code. But since you haven't mentioned what query you're talking about, it's difficult to say.
As already mentioned, the best way to find out about the current user's block status is to use api.php?action=query&meta=userinfo&uiprop=blockinfo. If there's information missing there that is exposed to users via the web UI, file a bug and it can be added.
IIRC, we were thinking about this in the context of user account creations. But this data should come with block errors from action=edit and others as well.
Or, as already stated, the information can be queried by the client when it's needed.
If someone wants to write code for this, here's a general outline of what you'd need to do:
- Refactor the parsing of block information in ApiQueryUserInfo into a static method (e.g. ApiQueryUserInfo::getBlockInfo( Block $block )).
- Bonus: Use the same static method in ApiQueryUsers and ApiQueryAllUsers. Keep in mind private vs public if you consider adding stuff like the block target.
- Identify the modules that have a "blocked" error. Don't forget extensions.
- Identify the specific error messages that indicate "blocked" status.
- Detect those messages, and use $this->dieUsage( $description, $code, 0, array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ) ) when reporting the error.
Change 209974 had a related patch set uploaded (by Alex Monk):
API: Give block details along with errors