Page MenuHomePhabricator

VisualEditor: Add support for spam blacklist errors in save dialog
Closed, ResolvedPublic

Description

If a user hits the spam blacklist they VE responds merely by informing them "Error: Invalid error code". This is...not helpful.


Version: unspecified
Severity: major

Details

Reference
bz50826

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:49 AM
bzimport set Reference to bz50826.
  • Bug 51139 has been marked as a duplicate of this bug. ***

Created attachment 12821
Developer console dump

A very helpful user in #wikipedia-en-help gave me this screenshot of what we get back from the API when TitleBlacklist rejects an edit.

Attached:

mPNNB.jpg (760×1 px, 169 KB)

joedecker wrote:

Sounds like y'all have screen shots, but for those of us playing the home game, when I press "Save Page" on a blacklist-blocked edit, that window (with the edit summary, etc.) stays up, and "Error: Unknown error" appears below the edit summary box, to the left of and slightly higher than the Review your edits/Save page buttons--the latter inactive.

MacOSX/Chrome 28.0.1500.71, tested with an examiner.com URL at [[Chad Griffin]] with an incognito window/logged out.

So we get the matched url from the API. Ideally we'd get a usable message as well.

Given the following sample (and latest mediawiki/core and SpamBlacklist configured with [[m:Spam_blacklist]])

index.php?action=submit gives the following:

The text you wanted to save was blocked by the spam filter. This is probably caused by a link to a blacklisted external site.
The following text is what triggered our spam filter: http://fidosoft.de and http://cl.ly

These are constructed in EditPage::spamPageWithContent by the "spamprotectiontext" and "spamprotectionmatch" messages respectively, which are actually in mediawiki core. The latter message takes $1 as parameter and EditPage.php sets that to the result of Language::listToText( Array ).

The API gives:

"edit": {
    "spamblacklist": "http://cl.ly",
    "result": "Failure"
}

For some reason it isn't getting the second url? The SpamBlacklist API hook looks like it is doing implode( '|', Array ) but aside from an array being nicer than a pipe-separated list, we're not getting either. Only the first url is returned.

So either:

  1. SpamBlacklist needs to provide a processed message

or:

  • SpamBlacklist needs to provide both urls, not just the first (I tested latest master, SpamBlacklist@3390081e4c6). Though this bug should be fixed either way, if we don't get a processed message, needing both is a blocker.
  • We'll load these 2 core messages as part of ve.init.mw.ViewPageTarget
  • We'll need an equivalent of Language::listToText in core mediawiki.language.js (though I suppose join(', ') could do meanwhile).

Change 73964 had a related patch set uploaded by Krinkle:
mw.ViewPageTarget: Add support for spam blacklist

https://gerrit.wikimedia.org/r/73964

Though I knew that the SpamBlacklist has logic in place for returning multiple urls (bug 30332, Ia951d5795c5cedb) it didn't seem to work.

Apparently it does work now. I can't consistently reproduce it only giving one. I'll presume it was an error on my part or an edge case in the regex SpamBlacklist is using and complex wikitext as input.

I've amended the patch set to display multiple urls separated by comma if there is more than one.

Change 73964 merged by jenkins-bot:
mw.ViewPageTarget: Add support for spam blacklist

https://gerrit.wikimedia.org/r/73964

Fixed and will be going out in a few minutes.