Commit graph

6839 commits

Author SHA1 Message Date
Umherirrender dc4dd928b7 Call IContextSource::getAuthority instead of IContextSource::getUser
Change to use Authority object where possible
to use the interface instead of implementation

Change-Id: I90ef126b3d799c3fc27467a4ffe671785c446d3e
2022-07-03 16:37:18 +02:00
jenkins-bot 2709583b52 Merge "Clean up AbuseFilterViewExamine and AbuseFilterExaminePager" 2022-07-03 14:16:57 +00:00
Matěj Suchánek be247401bb Clean up AbuseFilterViewExamine and AbuseFilterExaminePager
Move most stuff from the pager to the view class to untangle
circular dependency. Declare class properties as private.
Leave input validation to the form.

Change-Id: Ia8b1a9d08af9c0cac23b34f6bbbe2c44d01f6c8c
2022-07-03 11:29:43 +02:00
Matěj Suchánek e7492a230f Replace unnecessary use of User
In action=abusefilterunblockautopromote, leave UserIdentity
instantiation to the parent. Note that this changes the "code"
in the response from "baduser_user" to "baduser".

Change-Id: I97d2bf3fa3c5486e461823f840cad2763e1bcfea
2022-07-02 23:58:08 +00:00
Matěj Suchánek 799e1db093 Convert remaining permissions checks to use Authority
Change-Id: I5e996cac37bc806db6c3d7ad5c666a606cd79236
2022-07-02 14:49:47 +02:00
jenkins-bot f3ec0063ac Merge "Migrate AbuseFilterPermissionManager to authority" 2022-07-01 22:08:17 +00:00
DannyS712 139ca18efe Migrate AbuseFilterPermissionManager to authority
Almost all callers already provide an Authority in the form
of a User object, so mostly just need to change the typehints

Depends-On: I58661943c7e1acb6ff09798ee1a30be0fde3f459
Change-Id: I2ad86859c8194c14d7331f58db62b7cff4698085
2022-07-01 06:58:17 +00:00
Translation updater bot 543f2c81f3 Localisation updates from https://translatewiki.net.
Change-Id: I14f186548cf1fe8f64f10e0891257e4189e8166e
2022-07-01 08:51:32 +02:00
jenkins-bot 27c19027de Merge "Show syntax error message in an error box on Special:AbuseFilter/test" 2022-06-30 21:20:00 +00:00
Matěj Suchánek 3b5b3cbae7 Show syntax error message in an error box on Special:AbuseFilter/test
Otherwise it's barely noticable.

Change-Id: Iff10036996c9e190c850d0b24f3ea0817624b95f
2022-06-30 20:23:22 +00:00
jenkins-bot af93d83b51 Merge "tests: Improve RCVariableGeneratorTest" 2022-06-30 07:29:48 +00:00
Umherirrender b833d740fd tests: Improve RCVariableGeneratorTest
- use unique ids to find rc entry, to support parallel unit tests and
rdbms where the auto increment value must not increase in time
- Change from Title::newFromText to Title::makeTitle to avoid parsing
the title
- Pass the title to editPage() to avoid reparse of the title
- Use assertSame to compare values

Change-Id: I455b4412a6669475463dee7dea0969ae1cbd8ebb
2022-06-29 22:34:44 +02:00
Matěj Suchánek 93acf0d80b Delimit namespace and title text in warning keys
Bug: T311543
Change-Id: I20f42d27d35390dcba96cc26bcc245cbeeff59f5
2022-06-29 19:39:24 +02:00
Matěj Suchánek 60e03c965e Fix form input normalization
Prevent invalid assignments to properties. On
Special:AbuseFilter/test/123, handle when id of
a non-existing filter was provided. Allow '0'
as user and title on Special:AbuseLog and
Special:AbuseFilter/test.

Change-Id: I196ae62b165d1a60babaf4fe6bd733aa52be1726
2022-06-29 12:19:24 +02:00
jenkins-bot 8d4c5d4d33 Merge "Use LinkTarget in ConsequencesExecutor" 2022-06-29 08:52:37 +00:00
Translation updater bot 7b05656498 Localisation updates from https://translatewiki.net.
Change-Id: I7add917c108b207bf5122ce63292795db43fe8e7
2022-06-29 08:34:33 +02:00
Reedy 60cb198e81 SpecialAbuseLog: Don't call explode() on null
Bug: T311579
Change-Id: I2481beb2344a57242795a722e255e119ea29ac18
2022-06-29 01:14:07 +01:00
jenkins-bot 2314785568 Merge "tests: Avoid Title::newFromText/title parsing" 2022-06-28 21:43:11 +00:00
jenkins-bot 00944567c6 Merge "tests: MWTimestamp::setFakeTime is reset by core" 2022-06-28 21:43:09 +00:00
jenkins-bot 8ee28b2373 Merge "pager: Declare Title only for local filters" 2022-06-28 21:40:48 +00:00
Matěj Suchánek 4beca85154 Compute user and page age relative to recent change timestamp
These are apparently the only two variables for which we can
quickly determine their value in such simple way.

Later, we can also try it for recent contributions.

Bug: T102944
Change-Id: Iecfa9e5c5ba8c078691334b676cc6f289790cb74
2022-06-28 20:53:33 +00:00
Umherirrender 32a97e8d15 tests: MWTimestamp::setFakeTime is reset by core
It is in MediaWikiTestCaseTrait since 438b392

Change-Id: Ib89406fdbad0c9fecada50c8f1ee45e27d17c522
2022-06-28 20:48:31 +00:00
Umherirrender 637a88316b tests: Avoid Title::newFromText/title parsing
Using Title::newFromText is parsing the string, which is expensive.
Just use Title::makeTitle when the result is known.
editPage() can take a Title or WikiPage instead of a string, avoid
creation of Title there.
The default ns on editPage() is only needed when giving a string

Change-Id: Ie303b9e6d6b8d6ac80286059f8e86bfc76b779af
2022-06-28 22:46:45 +02:00
Matěj Suchánek b381636974 Extend RCVariableGeneratorTest
Make an edit, retrieve the recent change and test computed variables.

Change-Id: I04beed0b1f7c5adb47e71fd9b03102cb23838e16
2022-06-28 19:50:11 +00:00
jenkins-bot e6c61b94f3 Merge "Replace deprecated HTMLForm methods" 2022-06-28 19:47:11 +00:00
jenkins-bot 5f7e69757c Merge "pager: Fix LinkBatch for user name" 2022-06-28 19:33:19 +00:00
jenkins-bot c8dacb59d9 Merge "Use UserIdentity/Authority in SpecialAbuseLog" 2022-06-28 19:33:10 +00:00
Matěj Suchánek 5dca456535 Replace deprecated HTMLForm methods
Change-Id: Ic9ba981b94541b181acf88c3c40c205ab81962a8
2022-06-28 19:01:54 +00:00
Matěj Suchánek 7ae2060b27 Avoid array to object cast in filterToDatabaseRow
Both callers immediately call get_object_vars
to cast it back to array. Avoid this roundtrip.

Change-Id: I6525d76f8a03a4d28c2b50b580c539affe98064f
2022-06-28 18:46:28 +00:00
Umherirrender 1f8e6f5737 pager: Fix LinkBatch for user name
Adding the user id to the LinkBatch does not preload the correct page

Change-Id: Iacc852fe1f3ee74849af6146218aecaff70363d9
2022-06-28 20:37:41 +02:00
Umherirrender 5c8296393c pager: Declare Title only for local filters
No need to get the Title for the global filter

Change-Id: I9d282f0112e7e380615ea3760c17f02792694113
2022-06-28 20:33:46 +02:00
Umherirrender 20fd8f7b07 Use LinkTarget in ConsequencesExecutor
The Parameters class already only needs a LinkTarget

Change-Id: I4e8e1d7c92f41502a084be3359b97e0d434f08c0
2022-06-28 19:46:50 +02:00
Umherirrender 9abc464e3d Use UserIdentity/Authority in SpecialAbuseLog
Change-Id: I5b3b2b758e17c94298e7217d755dd8c7b08cb1ac
2022-06-28 19:30:37 +02:00
jenkins-bot f9a2d4cf6c Merge "Use UserIdentity in FilterStore::doSaveFilter" 2022-06-27 21:56:57 +00:00
Umherirrender 5f979bcf16 Use UserIdentity in FilterStore::doSaveFilter
Change-Id: I8cbdaff1bd049a893b69f2ce13f0ba30b96f93b4
2022-06-27 22:39:37 +02:00
Umherirrender 30fefb75bf Use UserIdentity in ConsequencesExecutor
Change-Id: I281a30610595ed3e984f43aa747eff37abe72939
2022-06-27 22:05:18 +02:00
Translation updater bot 2d6ff71431 Localisation updates from https://translatewiki.net.
Change-Id: I7377708240ab7ecf160539317cd81c82d18a6b24
2022-06-27 08:17:17 +02:00
Daimona Eaytoy f33bc5868c Set the 'timestamp' var in addGenericVars
This was most definitely my intention when I introduced the concept of
"generic vars", so it's a bit surprising to discover, 3.5 years later,
that the timestamp isn't computed there.

Also make the timestamp always be a string for consistency, since that's
the type documented on mw.org. I've manually checked all filters on
Wikimedia wikis using the timestamp variable, and added explicit int
casts where needed (although I think they'd still work due to implicit
casts).

Change-Id: Ib6e15225dd95c2eead7e48c200d203d6918e0c18
2022-06-26 14:49:40 +02:00
Matěj Suchánek 40c5712311 Pass RecentChange to addGenericVars
Change-Id: Ia843c23b46ecf8e9fe987a538a09e69f845f4488
2022-06-25 13:03:03 +02:00
Umherirrender 3d3c45f348 tests: Mock WikiPage in unit test
Bug: T297688
Change-Id: Ic1655141564f02530b1ae6b625a1d3e261a00304
2022-06-24 22:22:24 +02:00
Translation updater bot 2e73774895 Localisation updates from https://translatewiki.net.
Change-Id: Iabd2131b111d7a40268373f09e31a6d52307884b
2022-06-24 09:29:54 +02:00
jenkins-bot f78a92cb2e Merge "Remove $info argument from ReversibleConsequence::revert" 2022-06-24 02:07:31 +00:00
Translation updater bot fac219ba0c Localisation updates from https://translatewiki.net.
Change-Id: Ie1e2a49b5ff2f2aa4d911e68d2bd03d85ddc21de
2022-06-23 09:01:53 +02:00
Translation updater bot 7a072b942c Localisation updates from https://translatewiki.net.
Change-Id: I65f56eebf85087c669eee2a127b150e19d753463
2022-06-22 08:12:46 +02:00
libraryupgrader 81749eb07f build: Updating got to 11.8.5
* https://github.com/advisories/GHSA-pfrx-2q88-qq97

Change-Id: I07af806a7c19c5dfe0e8fb897ab632da4da80c94
2022-06-22 05:03:44 +00:00
Translation updater bot dde42a85da Localisation updates from https://translatewiki.net.
Change-Id: I5a1d8ac67628772a214c940aa6d7390a98a35b65
2022-06-21 08:29:43 +02:00
Umherirrender e18136f269 Convert to abstract schema
Rename index on postgres and fix nullable fields

Bug: T259377
Change-Id: I97cb12e6aa25d75ea24e187174db2fe88e5ce790
2022-06-20 17:19:57 +00:00
Umherirrender d0499bfa13 Revert "Localisation updates from https://translatewiki.net."
This reverts commit fb05e25c82.

Reason for revert: Empty translation in aa.json not supported

Change-Id: I5ac74f4a06d7f86d6d657ea889ed995a7663b480
2022-06-20 16:26:42 +00:00
Translation updater bot fb05e25c82 Localisation updates from https://translatewiki.net.
Change-Id: I91636def75b631a6c2584a026f51b9a331fd96c7
2022-06-20 08:15:49 +02:00
Translation updater bot 325c13f61d Localisation updates from https://translatewiki.net.
Change-Id: I98cbb62d84003aa0860e5ed324acf1b33d7d01e2
2022-06-16 09:23:32 +02:00