Commit graph

143 commits

Author SHA1 Message Date
Daimona Eaytoy d57b266497 Reinforce CSS selectors to avoid overriding by MonoBook
Tiny change to avoid problems with MonoBook skin.

Bug: T78304
Change-Id: I611a84b2763fca9aa821b5ce15e216bde5d05617
2018-03-27 20:14:08 +02:00
Daimona Eaytoy 89e6778793 Switch editor to Ace and provide syntax highlight
Replace the conditions textarea with Ace editor for editing and testing
filter. This uses a soft dependency on CodeEditor; if the latter isn't
installed, the classic textarea is used. The user is still able to
switch between the editors on the go; the new buttons may look a bit
ugly now, but after switching to OOUI they should get much better.
Finally, added a custom syntax highlight for AbuseFilter rules.

Bug: T39192
Change-Id: If3d6a994142e34686bb7fc9f09093f751b599485
2018-03-23 12:39:22 +01:00
Daimona Eaytoy 3bc4bfc4d5 Add search for filter patterns
Adds an option for searching filters with a
specific pattern in the main page, together with already existing options.
Plain search and regex are available, only for users with the
view-private right. The search is performed directly on the database.
If the user actually searched for something, it is also added a column to
Special:AbuseFilter showing a snippet of the pattern from each filter, with the query match highlighted.

Depends on: I8144062b1f273d0d8932203ffcb7a71aca60bba9

Bug: T87455
Change-Id: Ibcd84ff84edca481328210ee857b0ab723028632
2018-03-17 14:54:48 +00:00
Melos 799a2fb1ed Always show abuse filter public comments as plain text
Public comments are parsed in some places and they are
shown as plain text in others. Always show them as
plain text instead of parse them.

Bug: T173249
Bug: T141670
Change-Id: I173ffab1a99c1536cca260b76be0d95a4966b139
2018-03-15 20:14:00 -04:00
James D. Forrester de2a7b07d4 build: Replace jshint with eslint
Bug: T186753
Change-Id: I067adf86a220d59ff1693bef74d7590d4c63d3c2
2018-02-08 16:26:50 +00:00
Alex Monk 086dd0d741 Use prop instead of removeAttr for syntax check disabled status
Bug: T169385
Change-Id: Ia3f598a3ccd0c12ec0c35450ed12f0ddbd739962
2017-08-09 16:58:00 +00:00
Matěj Suchánek 20c10c8159 Remove all CSS classes from indicator to avoid collision
When you tested filter against the change (with failure) and then
checked the syntax (with success), the new CSS class was overriden by
the old one, that's why the red X stayed.

Bug: T129753
Change-Id: I34cdba72f0b0e24e97083ba6b47554d0c8b826cf
2017-07-14 17:55:19 +00:00
Matěj Suchánek eb8541eab5 Use mw.Api.parse() for previewing warnings
And add the filter id as the second parameter to the message.

Bug: T68351
Change-Id: Iee8ac20d3cc9c0f6340ec6f339b0e51d7c88f976
2017-05-31 09:06:31 +02:00
Umherirrender fcfdb9a6b6 Add stylelint for css files
Fixed the following rules:
color-hex-length
function-parentheses-space-inside
selector-list-comma-newline-after

Change-Id: Ib30aaeb6179617caa693219d434237e950ef5270
2017-04-16 20:21:40 +02:00
Ori Livneh 3f4a0df551 Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Bug: T127608
Change-Id: Ib947620d9dd4d9e5760b2b7ab42f5bea1734e654
2016-02-21 00:51:11 +00:00
Ori Livneh eed0747629 Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y --iterations=1000 --filters=01234mepb {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Change-Id: I82b3141f3f19e594ab955f250e47dc6311e337c2
Task: T127608
2016-02-20 20:17:20 +00:00
helderwiki 20dabefe22 Improve error handling for HTTP requests
The API provides more details about HTTP errors, so show these to
the user instead of a generic "An unknown error occurred."

Bug: 68767
Change-Id: I3188b9729c815a07c65a7dbef4d40deebe29b87d
2014-08-02 11:56:32 +00:00
helderwiki 1717b743f8 Use POST method for action=abusefilterevalexpression API requests
Needed as tests take arbitrary user input through a textarea,
which can get rather big. GET cuts it off sometimes.

Follow-up to I317f5d7c372710617a7a6526cd4613de9660a40a

Bug: 47298
Bug: 68767
Change-Id: Ibab02be4c4e5640a09a1a76a4aa3e1a9520f489d
2014-07-28 20:21:14 -03:00
se4598 8125decd66 fix "JQMIGRATE: jQuery.fn.toggle(handler, handler...) is deprecated"
Bug: 65804
Change-Id: Ie25caa8ee2c2be9c5a2c13b3415fcd2d32ad7fb1
2014-06-08 20:59:50 +02:00
Sorawee Porncharoenwase 37d1a5c3b1 Preload abusefilter-warning if created page is blank
This patch makes a new warning message preload the text 
of MediaWiki:abusefilter-warning when the message is created 
through the filter editing view. Generally, it will make 
users more convenient because filter warnings
usually have a pattern, and preloading a pattern from the page
will save time. This patch doesn't work when
MediaWiki:abusefilter-warning hasn't created yet.

Change-Id: Ia327463c52060bfd55c0a1fa6fcec592cc3c3999
2014-01-26 15:22:28 +00:00
Amrutha S 7fd788f9d4 Increased the number of rows of AbuseFilter's Examine Past diffs table
The text areas for the table row had only 5 rows initially which was
small and it needed scroll to view it completely.
Now it has been changed to 25.

Bug: 59866
Change-Id: I77a092ac956bd9a9e4b7eb38abb16876087b8560
2014-01-11 12:54:43 +00:00
Helder.wiki c6a0a7daca Load filter conditions when the user presses ENTER
Cleanup:
- Trim the field value before trying to load the filter
- Add the pattern to the box using .val() instead of .text(), to
  update the content even if the user has made changes to it

Bug: 51402
Change-Id: I4ae671941571dce206448424f8e996cb99ac8d41
2013-07-23 14:01:02 -03:00
jenkins-bot 2e8fc6f751 Merge "Prevent custom warning messages for global rules" 2013-07-02 21:41:48 +00:00
Marius Hoch 013889c5ac Prevent custom warning messages for global rules
This prevents an abuse filter admin from setting a custom warning
message (which are references to a non-translated, local wiki page),
for global filters (which can be on any wiki in any language).

bug: 45164
Change-Id: If61716053b75f45e4b70f78d3809ddd02ac6d83e
2013-07-02 23:20:06 +02:00
MatmaRex 3d4d705b06 AbuseFilterViewDiff: Make diffs use standard styling (and more)
They still used old 1.18-style diffs, with styles copied from core.

Also:
* Remove the distinction between "simple" and "multiline" diff chunk,
  enabling consistent styling
* Always show word-level diff, even in previously "simple" chunks
* Ensure the full context is always shown. This was clearly intended
  (showing straight side-by-side comparison if there were no changes
  and in "simple" chunks, diff otherwise; showing chunks with no
  changes), but the default context is only 2 lines.
* Remove the distinction between 'wikitext' and 'text' diffs (all are
  treated like 'text' was); it's impossible to show parsed code with
  word-level diff, and it was only enabled for "simple" chunks, all of
  which are intended to be one-line strings and are shown unparsed
  elsewhere (e.g. filter description on the list on Special:AbuseFilter)

Bug: 36478
Change-Id: Ie24ad5ac5a9a2bc9b8f0fc0c4a03d5dfe7a6a83f
2013-06-29 23:43:45 +00:00
MatmaRex 697e2b2415 CSS: Minor code style fixes
Change-Id: Ib0b6e441be90a76a956884e0925e808ce23d25eb
2013-06-10 18:52:15 +02:00
Marius Hoch baf5001d34 Remove redundant class for syntax errors
Removed the redundant clss mw-abusefilter-examine-syntaxerror
as it was causing trouble because the syntax checker in
ext.abuseFilter.edit.js wasn't aware of it.

Change-Id: Ibb90c3e096c3914905c03a3e30c08ba8d14c9024
2013-05-24 16:45:35 +02:00
Marius Hoch f883ad8675 Use POST method for action=abusefilterchecksyntax API requests
Needed as filters take arbitrary user input through a textarea,
which can get rather big. GET cuts it off sometimes.

Bug: 47298
Change-Id: I317f5d7c372710617a7a6526cd4613de9660a40a
2013-04-17 15:09:43 +02:00
Marius Hoch 87094b9c0a Add .jshintrc for AbuseFilter and make it pass
Change-Id: I1cee072e6c751e441e77e6f005676fe13841283e
2013-04-17 15:03:36 +02:00
Timo Tijhof 5d50832447 JSHint: If you use 'use strict', make sure you actually pass it.
Someone added "use strict" to AbuseFilter JS files, but it didn't
actually pass in strict mode.

Change-Id: I0cf26b4dacfa88fb40d0595276db65239823763a
2013-04-02 21:44:01 +02:00
Marius Hoch e3d15fe915 Overhaul of the AbuseFilter JS
I've changed the JS of the AbuseFilter extension to match our
coding conventions and made it use mediaWiki.Api(). Furthermore
I fixed several error handlers and made some things nicer in
general while trying to not change the user appearance.

I've tested the changes as good as I could (I'm pretty sure everything
works).

Change-Id: Iaa0f99367bd7e0bfaf7249dcc9ac9ce9881b46e1
2013-03-07 14:14:25 +01:00
Marius Hoch 1958d74854 Fix AbuseFilter JS
Temp. fix, please look at https://gerrit.wikimedia.org/r/30110

Change-Id: Ic890a6f7b39618dba9f310244777e69435940cce
2012-10-26 16:21:08 +02:00
Marius Hoch f52f940ee5 Fix the AbuseFilter JS
This is bad style, but it works... please take a look at
https://gerrit.wikimedia.org/r/30110 which is much cleaner
and doesn't have the problems as well.

Change-Id: I91684de0c8594917736812846ed3782653a46e99
2012-10-26 15:57:54 +02:00
Siebrand Mazeland 176227e721 Maintenance for AbuseFilter extension.
* Replace deprecated methods.
* Remove no longer needed function fnmatch().
* Remove superfluous newlines.
* Remove unused and redundant local variables and globals.
* Deglobalization.
* Update documentation.
* Fix incorrect return values or add FIXMEs when in doubt.
* Escape output in a few places where needed.
* Remove unneeded MEDIAWIKI constant checks.
* Fix various JSHint/JSLint issues.

Patch Set 11: Merged https://gerrit.wikimedia.org/r/24701 into
this one per Siebrand's request

Change-Id: I02ba4ce31b6aca5b7324114093f8ece143abc295
2012-10-09 22:26:45 +02:00
Andrew Garrett 18bac6fed9 AbuseFilter: Make it possible to have differing default warning messages for differing filter groups.
Includes JS to sneakily change the default message if the user changes the filter group without having selected the "warn" action yet.

Change-Id: Ic753c3e018321dba3bf9f6d7bcee10a49c9faac8
2012-06-26 21:56:30 +02:00
Szymon Świerkosz 36678a7b00 (bug 18145) Diffs on some /details views are stretched horizontally.
I have changed the table-layout to fixed
and increased width from %80 to 100%.

Change-Id: I7a3c6c1bfe491b8e5182f05bc2df2c1d016120d7
2012-04-13 16:52:00 +02:00
Tim Starling 44c29b8c4f * (bug 34538) Fixed compatibility with $wgResourceLoaderExperimentalAsyncLoading in some extensions.
* Tested AbuseFilter.
* Did not test ArticleCreationWorkflow, Configure, ContributionTracking, FlaggedRevs, FundraiserPortal, InlineCategorizer, MarkAsHelpful, Math/Mathjax.
* Fixed a typo in a comment in LiveTranslate.
* Did not review extensions alphabetically after MoodBar.
2012-02-21 04:03:00 +00:00
Robin Pepermans c103fac20f It's better to set directionality in html than in css. Also fixes bug 34297, because the css only affected the edit form and not the test form.
Also add a bit of docs.
2012-02-09 17:00:34 +00:00
John Du Hart f57debc190 Followup r98495, fix double escaping 2012-01-02 08:02:40 +00:00
John Du Hart ee051870ae Adding @embed for RL 2011-11-22 16:10:49 +00:00
Brion Vibber a3b99c0d7c * (bug 31870) Fix regression in AbuseFilter: pass/fail checkmark images for syntax checks work again
Was broken by r81905 consolidating background-repeat and background-position into a single background rule, which implied a 'background-image: none' overriding the background-image values set by other rules.
Restored them & added a comment so the next person won't do the same.

Also moved the image files to match the reorg of the css in r95572, which would have broken these images if r81905 hadn't done it first. ;)
2011-11-03 00:13:27 +00:00
Sam Reed d808b53fc4 Swap
/*
 *

for

/**
 *
2011-10-26 03:49:06 +00:00
John Du Hart 6018d5fc4c Followup r95572, replace insertAtCaret with textSelection per CR 2011-09-30 01:57:00 +00:00
John Du Hart 9c75f9907f Followup r95572, minor tweaks per CR 2011-09-30 00:48:00 +00:00
John Du Hart 4926aeae24 Followup r98490, since the module names changed the variable names need changing as well 2011-09-30 00:05:08 +00:00
John Du Hart 3f06314486 Followup r95572, rename API modules to reduce chance of collisions per CR 2011-09-29 23:30:42 +00:00
John Du Hart 39f30c3f22 Followup r95572 to change variable names and use an associative array per Krinkle and Roan on IRC 2011-08-26 20:26:57 +00:00
John Du Hart b30697e94c Adds ResourceLoader support to AbuseFilter
Rewrote javascript to use jQuery
Added API modules to replace sajax_* calls
Solves bug 29714
2011-08-26 20:12:34 +00:00