Commit graph

264 commits

Author SHA1 Message Date
Umherirrender 1a58507870 build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
Change-Id: I5f37c45d748d5f0da21aceaef32cc89367e312ff
2017-07-08 20:49:30 +02:00
jenkins-bot ee40953288 Merge "Make "Description" edit field bigger when editing AbuseFilter" 2017-07-06 00:49:26 +00:00
jenkins-bot fa40526e29 Merge "Improve tag name validation" 2017-06-23 19:33:51 +00:00
Huji Lee 4a590b0ea6 Make "Description" edit field bigger when editing AbuseFilter
Bug: T159792
Change-Id: I6f180eb9e19aaa4d35d2499125554d7a96048f64
2017-06-21 22:25:29 +00:00
Matěj Suchánek a6a76582e2 Improve interface for users who cannot modify filters or interface
Make selectors for groups and warnings read-only and also don't show
edit button for users without editinterface permission.

Change-Id: I7c27f27ed080396b3a64ccaf9a7ccf2c3231b839
2017-06-17 20:48:11 +02:00
Brad Jorsch cec8352e5b Improve tag name validation
Various pieces of the tagging system will break if the tag name contains
slashes or commas, so that should be checked for.

MediaWiki core (as of Ic5d75432) contains a method for doing just that,
so use it if possible.

Also require that tag names be either:
* Intended for reuse (canAddTagsAccompanyingChange)
* Already in use
* Creatable

This prevents the use of software-defined tags (unless whitelisted)
or tags that are blocked from creation (e.g. OAuth reserved tag
prefixes)

Add caching for tag lookup since it's used more often now.

Bug: T92956
Bug: T27151
Depends-On: Ic5d754323cbfd2c2b54c4df1245767946ebb1821
Change-Id: Ibc3095879f276a5436362f471b885e64f338522e
2017-06-15 20:15:20 -04:00
Umherirrender 24e4e85603 Use short array syntax - Views / api
Done by phpcbf over composer fix

Change-Id: I83ab556c8400354ecd09f33e1eb28caa17aa803d
2017-06-15 14:40:55 +00:00
TTO bc2c6ebd81 Revert "Check tags with ChangeTags::canCreateTag"
This reverts commit 5e2e4849b3.

Change-Id: Ic581537972801b68636dffc1962848f78128701c
2017-05-09 12:09:39 +00:00
Matthew Flaschen 5e2e4849b3 Check tags with ChangeTags::canCreateTag
These are also user-provided tag names, so should be checked with
ChangeTags::canCreateTag, which is intended for that purpose.

This check also applies on edits.

Bug: T164133
Change-Id: Iaf161d538f225a86c7abf8a8a347de9169d781bf
2017-05-08 20:31:58 -04:00
Matěj Suchánek 0b956a0d07 Disallow editing abuse filters for blocked users
This also changes the previous behavior - users who lost their rights
between opening and saving a filter now also get the message.

Additionally, User::matchEditToken() now doesn't use the global
$wgRequest.

Bug: T142389
Change-Id: I931068ff79a6835ad6e63a12ce9dbfcc1cb6c8b9
2017-04-11 06:29:36 +00:00
Huji Lee 8f53126853 Remove the "flag the edit in the abuse log" checkbox
Bug: T154091
Change-Id: I40c3176127bb168672b376147bffcdbd2aaff237
2017-02-13 14:27:44 -05:00
MusikAnimal 541fd57e46 Don't escape text in some messages so that admins can add links to external tools
Admins already have the ability to edit site JS, etc., so I don't think we should be concerned about malicious content

This patch allows markup in all messages in the edit interface, except the labels for the checkboxes

Bug: T157235
Change-Id: I5f1a2cd536a2c7ec5f7a5d7afbf124104bfcd975
2017-02-06 22:35:45 +00:00
Matěj Suchánek 16e71d3985 Cast stashed values to integer
Stash may return false if the value hasn't been set yet. This basically
means 'zero'.

Steps to reproduce: create a new filter and open it. If it doesn't have
any hits, the second message parameter is missing instead of being '0'.

Change-Id: I8f240dd87664ec99a98b843f9e5c4c8c9eed0532
2017-01-02 08:47:13 +00:00
Matěj Suchánek 0dca928f58 Don't show link to testing interface when the user cannot test filters
Clicking on this link only shows an error message unless the user can
edit filters.

Change-Id: Id912731e98f0f37b999d4a8e7ab190cd938825aa
2016-12-16 20:24:04 +00:00
jenkins-bot db896921da Merge "Make more fields sortable and one conditionally" 2016-12-12 20:03:45 +00:00
Matěj Suchánek 95989575cc Make more fields sortable and one conditionally
Users can now sort filters by whether they are visible and which group
they belong to. Sorting by hit count is only possible if the user can
actually see it.

Change-Id: I516111f96b9ef0beaa0c04f902e03712591371d1
2016-12-12 14:21:05 +00:00
Matěj Suchánek 8d10972f93 Don't show hit count field if it's always empty
If the user cannot see hit counts, this field is always empty, so there
is no need to have it shown.

Change-Id: I27c8639f901a3c7fa686378a1205b2ddebb7d665
2016-12-12 14:19:04 +00:00
Matěj Suchánek 3e6605c94b Check whether user is allowed to see the hit count
Bug: T120562
Change-Id: I464fc4806b52327a58fddb54404f5869c8431194
2016-12-10 12:06:43 +00:00
Subin Siby f4ddf5dd23 Replaced Linker::link() & Linker::linkKnown() with LinkRenderer
All usages of Linker::link() and Linker::linkKnown() has been replaced with LinkRenderer

Bug: T149346
Change-Id: Id087fe2aeaae81445e83e020ef66b541d9da4060
2016-12-06 23:21:31 -08:00
Matěj Suchánek b00d91605e Don't pass unsupported parameter
Change-Id: I40317c3e64eb3c96862991e49fc4b2041247779c
2016-12-02 18:23:15 +00:00
Kunal Mehta 9eb50de025 Avoid wfMessage() in AbuseFilter::buildVarDumpTable()
Change-Id: I3377623e6ba7f4c203de69d25f677162d6e61e65
2016-09-17 00:27:38 -07:00
Paladox b3081e1798 Update mediawiki/mediawiki-codesniffer to 0.5.1
Change-Id: I4b2055a76db4362a8136e3fd595228cf07d083a9
2016-08-23 16:18:27 +02:00
Kunal Mehta 972d9b7c0f Fix User::isAllowedAny() calls
Follows up bb277d437e.

The permissions are supposed to be passed as arguments, not in an array.

Change-Id: I50ab80e4fec0d3a983d4cd3957d340abd04126c4
2016-08-22 16:30:59 -07:00
Platonides bb277d437e Let abusefilter-modify users see history of hidden filters
d0439337 (I9e15326c) made abusefilter-view-private required
even for users with abusefilter-modify that can see and
change private filters.

Bug: T143365
Change-Id: I401effc5f1e429b5ec12c7f48dcc00ada74eafb6
2016-08-18 16:08:58 -07:00
jenkins-bot 67572c6071 Merge "Allow users with 'abusefilter-view-private' to view history/diff of private filters" 2016-08-11 01:43:41 +00:00
Glaisher 71b48cb28b Invalidate global abuse filter rules from cache when a previously global filter is edited
Bug: T142566
Change-Id: I3604b7eae21d5c50da4cbafe4abb15f4427eef15
2016-08-10 22:05:27 +05:00
jenkins-bot 8ad3a44145 Merge "Remove mention of generateDiffBody()" 2016-08-02 00:19:28 +00:00
Timo Tijhof e02915161c Remove mention of generateDiffBody()
This method was removed from MediaWiki in c35d1ce2.

Change-Id: Ifefb029e22160023217aeab615ccc6542521e68e
2016-08-01 13:43:25 -07:00
Glaisher d043933791 Allow users with 'abusefilter-view-private' to view history/diff of private filters
These pages are read only pages so it's better to let users with
'abusefilter-view-private' to view history and diff of private filters
as 'abusefilter-modify' is a read+write right.

Bug: T126129
Change-Id: I9e15326c8d681000ab13ef8a50fa0eed4c24dbe6
2016-07-25 10:19:06 +00:00
jenkins-bot 9bc9f058f2 Merge "Add GENDER to abusefilter-revert-preview-item" 2016-06-25 15:31:41 +00:00
Gergő Tisza 6a2627e944 Change some globals to work better with extension registration
Rename $wgAbuseFilterAvailableActions / $wgAbuseFilterRestrictedActions
to $wgAbuseFilterActions / $wgAbuseFilterRestrictions and make
them an associative array instead of a plain one, as that works more
sanely with extension registration. (The renaming helps to give more
useful errors to sites using the old config.)

Change-Id: I790d39c2849922d7daf7479f298cd90cf30af129
2016-06-06 19:53:53 +00:00
matejsuchanek 9f097e59db Add GENDER to abusefilter-revert-preview-item
Change-Id: I4fe0190238fc97409c18678a617a8f6a46d41bab
2016-06-04 15:07:40 +02:00
Aaron Schulz f7367dc970 Avoid master queries on page views in loadFilterData()
Bug: T92357
Change-Id: Ib7928067bc0b7ebd631d8abc96e3c24f81e78414
2016-04-28 13:56:41 -07:00
jenkins-bot c8a1e9fa49 Merge "Convert Special:AbuseFilter/import to HTMLForm" 2016-04-18 18:22:55 +00:00
jenkins-bot f4522444c4 Merge "Convert Special:AbuseFilter/history to HTMLForm" 2016-04-18 18:22:52 +00:00
tonythomas01 53b377a6d3 Convert Special:AbuseFilter/import to HTMLForm
Bug: T132284
Change-Id: Ife1ed3af19a4b4b506948763e4d92efc3a14a5bf
2016-04-18 23:07:31 +05:30
jenkins-bot 30534924c4 Merge "Convert Special:AbuseFilter/examine to HTMLForm" 2016-04-18 17:25:23 +00:00
tonythomas01 b21d6a22b1 Convert Special:AbuseFilter/examine to HTMLForm
Bug: T132284
Change-Id: Ie8bc13fd8602d94f53e574efb00f9908f0029ffd
2016-04-17 13:44:04 +05:30
tonythomas01 3b6ca98c6e Convert Special:AbuseFilter/history to HTMLForm
Bug: T132284
Change-Id: I14b98e92fa9e5ad2401c046bbaacd4a98daa5cc0
2016-04-17 10:57:08 +05:30
Aaron Schulz 43a538fe03 Fixes to filter profiling
* Defer the slow profiling updates to post-send
* Convert to the object stash, so that all DCs see
  the same values

Change-Id: I08316c6a3192bd69248cf5ab5a3ed8185341c313
2016-04-13 23:21:32 +02:00
Bartosz Dziewoński 337cad30d9 Add $wgAbuseFilterProfile to enable filter profiling
Follow-up to b60829a60c.

I'll fix up message translations on Translatewiki when this is merged.

Bug: T132189
Change-Id: I1ecaedd7489b264ed621309b6fbfb63b9287a437
2016-04-08 16:53:45 +00:00
Bartosz Dziewoński 39261ff5cd Revert "Removed filter profiling using $wgMemc"
This reverts commit afb78deb84.

I'll guard this behind a global and fix up the localisation messages
in a separate commit. This is a straight revert.

Bug: T132189
Change-Id: Iff4aa6d7d543db8f47c5f81f3c206dafcd5373dc
2016-04-08 16:53:34 +00:00
Bartosz Dziewoński 6298c91bde Remove executable bit from files
find . -perm /111 -type f | grep -v .git | xargs chmod ago-x

Change-Id: I1e5994ba0a74eafdeff262017f90d4c0f09f3ab4
2016-04-08 14:00:52 +00:00
Bartosz Dziewoński d2f7f86160 AbuseFilterViewEdit: Correctly reject non-existent historical versions
Return value of this function is already being checked for this.

Bug: T125572
Change-Id: I6f1d77d335a7ed269e6fbb9aaf2c3a7a566ae992
2016-04-03 00:11:29 +02:00
Glaisher ffcb4d945d Migrate (un)block logging to new system
Also
* Fix a bug where action-reverts doesn't work for anons
since the userid is always 0 for them, instead use the username.
* Start adding block log flags consistently with core

Bug: T124789
Change-Id: Ic6680dad891e2169b392fcfefc1e313af85bc92f
2016-03-21 15:26:59 +05:00
Matthias Mullie 8a9fccbcc8 Fix for tinyint(1)'s not accepting ''
These boolean values go through DatabaseBase::makeList,
which passes them along to DatabaseBase::addQuotes, which
shoves the value through DatabaseMysqlBase::strencode,
which in turn passes it on to DatabaseMysqli::mysqlRealEscapeString,
which eventually calls mysqli::real_escape_string on it.

This last one will turn trues into '1' and falses into ''.
MySQL (or at least my version, 5.6.17 Homebrew) complains about
receiving incorrect integer value '' for these tinyint(1) columns.

Bug: T67807
Change-Id: Iaef98c08589370f9288c1f3c80803b1a16b2506e
2016-01-29 12:18:53 +00:00
Siebrand Mazeland ce1396aea7 Add support for PHP CodeSniffer checks
Also fix any remaining errors and warnings.

Change-Id: Ie49c6172e6bbf8040e5524d33d2f719e96784745
2016-01-06 09:59:47 -08:00
Aaron Schulz dca2451597 Conversion to using startAtomic/endAtomic
This avoids breaking any outer transactions

Change-Id: Idcafec3b4c69948dbbb05677aaf7f65ed6c21574
2015-10-07 22:54:58 -07:00
Legoktm fe8cdc35ca Revert "Add "Last hit" timestamp column to Special:AbuseFilter list view"
This reverts commit 77d161f65c.

Bug: T106798
Change-Id: I265ae108aecbacfcce808ad21e18be4e0eef750e
2015-07-24 10:11:57 +00:00
glaisher 77d161f65c Add "Last hit" timestamp column to Special:AbuseFilter list view
It'll show the timestamp at which the filter was last triggered.
If there is no hit or if the user does not have the proper permissions,
it'll be blank.

Bug: T93564
Change-Id: I435af5caf457c548fa0737ed226d7f8640ff25d8
2015-07-17 10:40:45 +00:00