Go to file
Bartosz Dziewoński 82b6f191d4 Actually return errors for action=edit API
Setting 'apiHookResult' results in a "successful" response; if we want
to report an error, we need to use ApiMessage. We already were doing
this for action=upload. Now our action=edit API responses will be
consistent with MediaWiki and other extensions, and will be able to
take advantage of errorformat=html.

Since this breaks compatibility anyway, also remove some redundant
backwards-compatibility values from the output.

To avoid user interface regressions in VisualEditor, the changes
I3b9c4fef (in VE) and I106dbd3c (in MediaWiki) should be merged first.

Before:
    {
        "edit": {
            "code": "abusefilter-disallowed",
            "message": {
                "key": "abusefilter-disallowed",
                "params": [ ... ]
            },
            "abusefilter": { ... },
            "info": "Hit AbuseFilter: Test filter disallow",
            "warning": "This action has been automatically identified ...",
            "result": "Failure"
        }
    }

After:
    {
        "errors": [
            {
                "code": "abusefilter-disallowed",
                "data": {
                    "abusefilter": { ... },
                },
                "module": "edit",
                "*": "This action has been automatically identified ..."
            }
        ],
        "*": "See http://localhost:3080/w/api.php for API usage. ..."
    }

For comparison, a 'readonly' error:
    {
        "errors": [
            {
                "code": "readonly",
                "data": {
                    "readonlyreason": "foo bar"
                },
                "module": "main",
                "*": "The wiki is currently in read-only mode."
            }
        ],
        "*": "See http://localhost:3080/w/api.php for API usage. ..."
    }

Bug: T229539
Depends-On: I106dbd3cbdbf7082b1d1f1c1106ece6b19c22a86
Depends-On: I3b9c4fefc0869ef7999c21cef754434febd852ec
Change-Id: I5424de387cbbcc9c85026b8cfeaf01635eee34a0
2019-09-09 20:15:19 +02:00
.phan Migrate to new phan 2019-03-16 09:41:23 +00:00
db_patches Drop afl_log_id 2019-06-28 17:55:55 +00:00
i18n Localisation updates from https://translatewiki.net. 2019-08-26 09:05:28 +02:00
includes Actually return errors for action=edit API 2019-09-09 20:15:19 +02:00
maintenance Don't hardcode blockautopromote duration 2019-08-24 11:40:11 +02:00
modules Actually return errors for action=edit API 2019-09-09 20:15:19 +02:00
tests Actually return errors for action=edit API 2019-09-09 20:15:19 +02:00
.eslintrc.json build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0 2019-04-03 15:44:45 -07:00
.gitignore build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0 2019-04-03 15:44:45 -07:00
.gitreview Whoops, track not trace 2016-10-24 17:01:30 -07:00
.phpcs.xml Merge "Don't use wgLang and wgContLang" 2019-03-17 09:53:16 +00:00
.stylelintrc.json build: Bump devDependencies to latest 2018-02-10 21:00:53 +00:00
AbuseFilter.alias.php Add aliases for Serbian language 2018-12-24 02:16:55 +00:00
abusefilter.tables.pg.sql Drop afl_log_id 2019-06-28 17:55:55 +00:00
abusefilter.tables.sql Drop afl_log_id 2019-06-28 17:55:55 +00:00
abusefilter.tables.sqlite.sql Drop afl_log_id 2019-06-28 17:55:55 +00:00
CODE_OF_CONDUCT.md build: Updating mediawiki/phan-taint-check-plugin to 1.4.0 2018-09-01 05:29:54 +00:00
composer.json build: Upgrade phan-taint-check-plugin from 1.5.x to 2.0.1 2019-07-10 15:30:52 +00:00
COPYING Add COPYING 2014-01-22 21:21:10 +00:00
extension.json Add a new class for the CachingParser's AST 2019-08-25 17:29:16 +00:00
Gruntfile.js build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint 2019-05-06 13:56:54 -07:00
hooks.txt Add a hook to determine whether the current action should be filtered 2019-08-13 10:31:29 +02:00
package-lock.json build: Updating eslint-utils to 1.4.2 2019-08-24 04:08:38 +00:00
package.json build: Update npm dependencies 2019-07-31 17:29:00 +00:00