Commit graph

4 commits

Author SHA1 Message Date
Ed Sanders 6f12ed377f VE: Add explicit dependency on targetLoader
Change-Id: Ib61e5ae5f2bc28a02851d78cfa368438860bf871
2020-06-30 22:47:28 +01:00
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
Bartosz Dziewoński a4229f339e ve.init.mw.SpamBlacklistSaveErrorHandler: Update to receive entire response
Change-Id: Ifadf23d572a77e082edaa80e6c97792f8c1af4d3
Depends-On: I818d916275b8451af6910ddaa7cd4d7c653085ee
2018-12-07 14:17:55 -05:00
Ed Sanders 02ada1b4f2 Move in VE support code from the VE extension
Depends-On: I036ee32847cc3b25a1cc478247cfe54599781098
Change-Id: I1807a5d3d99ecab2bf4545a1bab3aa3f2ae64da8
2018-11-29 17:22:29 +00:00