Commit graph

7 commits

Author SHA1 Message Date
Bartosz Dziewoński 4b0bc0f47d VE integration: Remove "unrecoverable" errors
Bug: T307330
Depends-On: I9680cc416da5b27881aeb3502f506dcb5d4bb71f
Change-Id: Ie133c74072fa3e9ab934a6a8b2052d25b68d1cbf
2022-07-19 21:46:48 +02:00
Ed Sanders 3892280f1d build: Update linters
Change-Id: Icc5076d5cf757e7e70511c2b75a82b0a45cb47c9
2022-03-17 22:19:08 +00:00
Ed Sanders 4b5e2362fe VE: Add explicit dependency on targetLoader
Change-Id: Ied1af70713b3595b87e2ea2f45797777f32ff7a0
2020-06-30 22:47:18 +01:00
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
Bartosz Dziewoński 34cbad3d45 Distinguish AbuseFilter warnings and errors in VE
The VE save dialog will now only display a retry button for
AbuseFilter warnings, and not for errors.

Bug: T211241
Change-Id: I865e8078f79e6bbcb7134b11d5f834f84bb72589
2019-08-01 04:59:18 +02:00
Bartosz Dziewoński 800ff6d899 ve.init.mw.AbuseFilterSaveErrorHandler: Update to receive entire response
Change-Id: I8d5f60f8d54cbaaf1801a85cb6e12a8f3d4370a4
Depends-On: I818d916275b8451af6910ddaa7cd4d7c653085ee
2018-12-07 14:18:12 -05:00
Ed Sanders 687106d8af Bring in VE support from VE extension
Change-Id: Ib1354f0404209a15194895026ff9d179d16b1900
2018-11-30 10:59:16 +00:00