mediawiki-extensions-SpamBl.../includes
Bartosz Dziewoński 5ddc45b62c 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.

Additionally, remove incorrect 'message' value from action=upload
output. It was anyway redundant to the normal error information.

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

Before:
    {
        "edit": {
            "spamblacklist": "example.com/test|example.net/test",
            "result": "Failure"
        }
    }

After:
    {
        "errors": [
            {
                "code": "spamblacklist",
                "data": {
                    "spamblacklist": {
                        "matches": [
                            "example.com/test",
                            "example.net/test"
                        ]
                    }
                },
                "module": "edit",
                "*": "The text you wanted to save was blocked ..."
            }
        ],
        "*": "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: Id36aa6bdb8f873fe7deb8123a7fc774103721c01
2019-09-10 20:44:35 +00:00
..
ApiSpamBlacklist.php Move classes to includes/ 2018-02-24 17:08:28 -08:00
BaseBlacklist.php Remove backwards compatibility code for Revision::getQueryInfo() 2019-09-10 22:41:34 +02:00
EmailBlacklist.php Move classes to includes/ 2018-02-24 17:08:28 -08:00
SpamBlacklist.php Remove entry point check for files only contain classes 2019-08-07 17:16:41 +02:00
SpamBlacklistHooks.php Actually return errors for action=edit API 2019-09-10 20:44:35 +00:00
SpamBlacklistLogFormatter.php build: Upgrade phan-taint-check-plugin from 1.5.x to 2.0.1 2019-07-11 07:25:20 +00:00
SpamBlacklistPreAuthenticationProvider.php Add phan configuration 2018-02-24 17:26:25 -08:00
SpamRegexBatch.php Migrate to new Phan 2019-03-09 12:42:42 +00:00