Commit graph

124 commits

Author SHA1 Message Date
Bartosz Dziewoński 7095811872 ApiCoreThank: Fix handling of hidden author of revision
Follow-up to ef903f25d7.

Bug: T344623
Change-Id: Id2f2ea08407fcc9a1cc60e5930e041ef3242ffd1
2023-08-21 16:12:36 +00:00
Umherirrender f09186cd40 Use namespace MediaWiki\Request\DerivativeRequest
Bug: T321681
Change-Id: Ibbce4a56600fd362cc2bd4901927413325e2661b
2023-08-20 01:40:49 +02:00
gerritbot e2ed94cff3 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I491f0a12aaa4d70a4b6eccda3a478b223896feaa
2023-08-19 14:27:12 +00:00
Daimona Eaytoy 933f5591e5 Make ApiCoreThankIntegrationTest more robust
Use methods provided by core to create (non)existing test pages and
editing them. Make sure that revId is not 1, or the test will fail due
to T344475. This is needed by core change Ie2f1809d.

Change-Id: Ib7ea8c566d330db27c8abfcb4a783ddbd31787e0
2023-08-18 00:37:20 +00:00
jenkins-bot e14d02fbd1 Merge "ServiceWiring: Rename LogStore to ThanksLogStore" 2023-06-10 08:28:06 +00:00
Siddharth VP 6b71b859ee Use namespaced Echo classes
Change-Id: I1ff1d1772e615bc618ed2dd0080795cdfd98e79e
2023-06-09 23:16:35 +05:30
Daimona Eaytoy 22ccc90c75 Remove unneded @throws MWException
Echo can throw it but it should not be caught.

Bug: T328220
Change-Id: I0f91d6dd98f1f65de49d5f89fc2c80ba1a99ca16
2023-06-07 18:51:16 +02:00
Kosta Harlan 21254130e6
Hooks: Don't set Echo options for temp users
Bug: T337851
Change-Id: Ibd7c3987404674aefaefcaf261071b2b4da41f44
2023-06-01 10:54:29 +02:00
Func b96b4e1fde ServiceWiring: Rename LogStore to ThanksLogStore
`LogStore` is too ambiguous, usually services from extension should
be prefixed with its name.

Change-Id: Ia8a8474ac44ee9990b22ca4650d3ae5311744d19
2023-05-26 21:08:54 +08:00
jenkins-bot 3192cc6a99 Merge "API: Refactor to match modern code standards" 2023-05-21 08:51:59 +00:00
jenkins-bot 275b9d8de4 Merge "SpecialPage: Remove deprecations and adjust code style" 2023-05-21 08:25:30 +00:00
Mkostrzewski 1b3fbbbcc1 SpecialPage: Remove deprecations and adjust code style
Replaced deprecated calls to User::newFromName
and User::getEditToken with their direct
replacements. Adjusted the code to make it
easier to parse visually and fixed a potentially
nullable references in getFormFields

Bug: T337002
Change-Id: I97a1266d094452ddaea43357d20bc0119b97576d
2023-05-20 18:12:33 +03:00
Marcin Kostrzewski e483b844c9 API: Refactor to match modern code standards
I've moved all API classes into a separate folder,
as I felt like grouping modules improves readability.
APIs themselves had storage logic which I extracted and put
in another folder. I was originally going with an interface
to the storage to allow for other storage methods than
log entries, but the code was too tightly coupled with it,
so I've left that for another day. Added dependency injection
for all services and used ServiceOptions for config vars.

Bug: T337002
Change-Id: Ie8a1f435d635e1d0e1286f673bfe96cc4fdfe4fe
2023-05-20 17:57:26 +03:00
gerritbot d692bf34bb Update moved class RawMessage
See T321882. Moved in I195cf4c67bd514

Bug: T321681
Change-Id: I3409e462974dd9f4132a5f9db98b344fb8e48653
2023-05-19 10:31:13 +00:00
Matěj Suchánek 1f39e662d8 Replace deprecated hook handler with user locator
Change-Id: I97de923f1e63f05ab4e4887fd4fce6a5800e668b
2023-01-04 19:15:06 +01:00
Thiemo Kreuz a9878ab2ab Some smaller general code cleanups
In detail:
* Use more compact syntax to avoid a bit of code duplication.
* Use createMock() shortcut in tests.
* Avoid hiding code in strings.
* Remove a comment that literally repeats what the code says.

Change-Id: Ibedef380489451268e2e87f0864164e8f9737913
2023-01-03 12:30:41 +01:00
TheresNoTime 09e88294fc
Hooks: fix spelling mistake
Change-Id: I3aa9e02eee5cceca37edfacfa95cc89a80bc90c4
2022-12-21 20:38:48 -05:00
Dayllan Maza 819b71f9cd Thank: Fix thank action with no revision id
This is a temporary fix by not showing the thank action
on log entries for pages that use the new PagerTool.

There should be a follow up to allow PagerTool to call
a different hook that can take a reference to log entries
and properly generate the thank action depending on
the type (revision/log)

Bug: T325753
Change-Id: Icaaa044420baa26efdafc7f3fe049b9f58c72ee8
2022-12-21 11:10:22 -05:00
jenkins-bot 34cb755433 Merge "Add service container" 2022-12-16 01:52:13 +00:00
jenkins-bot 1daea2fcf8 Merge "Load Thanks JS on more special pages" 2022-12-16 01:24:32 +00:00
jenkins-bot 1702d0724b Merge "Adds the ThanksQueryHelper service" 2022-12-16 01:06:25 +00:00
Roan Kattouw 2e2c2c6188 Load Thanks JS on more special pages
Due to Ia03038e86c6a607c8b75eefedbf0285ca1a2f8c8 in MW core, the thanks
links now also appear on Contributions and Recentchanges/Watchlist. Load
the thanks JS module there too, so that users can send thanks without
leaving the page.

(Unfortunately, we can't add this module in the hook that adds the
thanks links, because we don't have access to an OutputPage object
there.)

Bug: T51541
Change-Id: I00ecd3b2c72332b6dc5290e649e6811cea0133af
2022-12-15 16:39:35 -08:00
Gergő Tisza 27b7bcd50d
Add service container
Change-Id: I25e91ff3294eaebe042bb8cbc90af72f37b4f1a9
2022-12-15 16:21:28 -08:00
Jon Robson e85b2c6996
Adds the ThanksQueryHelper service
Bug: T325094
Change-Id: I3a14d255546c12655dc4492194a07b0d205f0534
2022-12-15 16:11:28 -08:00
Umherirrender 290de639fa Replace deprecated Linker::formatComment
Bug: T324906
Change-Id: If7c5ad58fa3d21069ab47fc87ad683406c666273
2022-12-10 22:57:25 +01:00
AnaïsGueyte d287af1af1 Remove GlobalBlock calls from Thanks
Remove the usage of User::isBlockedGlobally and User::getGlobalBlock

Bug: T318891
Change-Id: I79450b34523d0ecb1a7a7b1e5a99b7650e02866e
2022-11-09 14:01:45 -05:00
Taavi Väänänen 62810454f3
ApiCoreThank: support subtypes in AllowedLogTypes
Bug: T191599
Bug: T316860
Change-Id: I0e21b3da5888bd5323bda6b59c5edddcb6ae14f1
2022-09-18 14:15:03 +03:00
Martin Urbanec 4bb9cc7e5a Do not use FormSpecialPage::preText
Soft-deprecated since 1.38. Bumping MW version
requirement to 1.38, as that's when the deprecation
happened. Compatibility policy says compatibility
is only guaranteed for snapshots
(with the respective MW version).

Bug: T312579
Change-Id: I384bc2a847dbe01798c4df1b713b0ca8e84aa187
2022-07-07 21:26:32 +02:00
Amir Sarabadani 725bd574d7 Don't call saveOptions in Hooks::onAccountCreated
It is causing deadlocks because after hook being called and done, core
itself calls saveSettings(). See:
a2e5997a4c/includes/auth/AuthManager.php (1515)

Bug: T306636
Change-Id: I5ded25f56a58bf89b894a8fdd6d8200fb378eb75
2022-06-01 14:19:15 +02:00
gerritbot dedcbc2fbe Fix usage of ApiBase::PARAM_* deprecated constants
The ones that are replaced with ParamValidator

Bug: T275455
Change-Id: I8e022b0df8e10bce39cecc34dde2f74a486f2aa6
2022-04-04 01:30:00 +02:00
gerritbot b76da576d9 Replace deprecated ApiBase::PARAM_ with IntegerDef ones
The rest of ApiBase::PARAM_  will be done in separate patches

Bug: T275455
Change-Id: Ia12b3578ee820fe366baf7b0c5e049ebde1d0de5
2022-04-03 22:16:45 +02:00
Umherirrender 778980cba6 Replace deprecated User::newFromIdentity with UserFactory
Moved the factory deeper into the code right before the one usage it
still needed a full user object.

Narrow done method arguments from User to UserIdentity
and use the identity directly

Change-Id: I2231db43f525a74e93dba8ea5865b256efd2dfce
2022-02-11 20:35:47 +00:00
Ed Sanders 1daf4bcf2d build: Update eslint config
Change-Id: If0871326eb35f8cb6ef026784cd04fca5754ab59
2022-01-25 22:01:31 +00:00
Matěj Suchánek 88b9e21e7a Don't throw away '0' edit summary
Change-Id: I73e07adff39a657a11fbab37716e1cbc17f2f255
2021-11-22 13:39:09 +00:00
libraryupgrader b33de1c9c6 build: Updating composer dependencies
* mediawiki/mediawiki-phan-config: 0.10.6 → 0.11.0
* php-parallel-lint/php-parallel-lint: 1.3.0 → 1.3.1

Change-Id: I9ca8baea50bee5b1f48744bb1ba3520421b8543a
2021-09-09 17:45:10 +00:00
libraryupgrader 56e6d0d365 build: Updating mediawiki/mediawiki-codesniffer to 37.0.0
Change-Id: Ic46650ca7e95698d6c2ee045a62a3f4115c14a2d
2021-07-24 06:11:02 +00:00
Tim Starling 8fdb3aca5e Fix history tools performance
Thanks was causing history views to do 4 DB queries per row, due to the
RevisionStore::getPreviousRevision() call. The reason for doing it is
that it doesn't make sense to thank someone for a diff which includes
multiple authors. This does not apply to history pages -- even for
filtered history views, you can thank someone for a specific revision on
the basis of its edit summary.

So, distinguish between history tools and diff tools. Do the expensive
thing only for diff tools.

Bug: T284274
Change-Id: Ib631100b82958065a327dd18c927af4a78b8be15
2021-06-29 13:01:05 +10:00
Thalia aa917f42e4 ApiFlowThank: Prevent thanking from Flow if partial blocked against thanks
Die earlier from ApiFlowThank::execute if them user is blocked from
Thanks, now that it is possible to have a partial block against Thanks
without being blocked from pages.

Follow-up to Id86d97a38c041fea4abcdbdd404428622df76669

Bug: T242785
Change-Id: Ia3683c3cab333b1193b2b77c6c18b5c343b5a5c7
2021-05-14 13:01:58 +01:00
jenkins-bot 93978d58d3 Merge "ApiCoreThank: Ensure partial block against thanks applies to revisions" 2021-05-13 19:37:58 +00:00
Thalia 60a879650d ApiCoreThank: Ensure partial block against thanks applies to revisions
Die earlier from ApiCoreThank::execute if them user is blocked from
Thanks, now that it is possible to have a partial block against Thanks
without being blocked from pages.

Follow-up to I290a7c39c6fcb22a8ab4a9ecbad76a239cb18ea0

Bug: T242785
Change-Id: Id86d97a38c041fea4abcdbdd404428622df76669
2021-05-13 19:57:51 +01:00
James D. Forrester da091690f1 Replace uses of DB_MASTER with DB_PRIMARY
Change-Id: Ic23cf2910afee9305587fa97d6e548bae0d2c721
2021-05-13 08:31:40 -07:00
jenkins-bot 7a170b639f Merge "Allow partially blocking giving thanks" 2021-05-13 12:43:55 +00:00
STran 43dd004a62 Allow partially blocking giving thanks
- Add hook to enable blocking thanks
- Check if user is blocked from 'thanks' action
  and disable giving thanks from  API and UI if so

Bug: T242785
Change-Id: I290a7c39c6fcb22a8ab4a9ecbad76a239cb18ea0
2021-05-12 13:06:09 -07:00
Tim Starling 49c82e02e5 Stop using legacy ActorMigration field "log_user"
Use ActorNormalization, introduced in 1.36.

Bug: T278917
Change-Id: I20b26ded92824db5f7d12cd354571f656600cc4b
2021-04-20 15:09:02 +10:00
ZabeMath f36a08e6bc Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: Iacc258705c4517c958a2568e47ba4f43963acc2e
2021-04-02 19:22:40 +02:00
Reedy 3749db7eba Namespace extension
Change-Id: Ic9e0b8d6b3cc6b9be4d6b026cb0a3b4a12aef38f
2021-03-20 18:22:17 -07:00
Reedy 4329060a7b $wgThanksLogTypeWhitelist has been replaced by $wgThanksAllowedLogTypes
Bug: T277963
Change-Id: I7ebc669b353bf6097cbcee3aca186d46419bb5c7
2021-03-20 04:43:48 +00:00
Umherirrender 545208c01b Use ::class for class names in Echo config
This makes visible where the classes are used

Change-Id: I166d5981f1fb8a0441e59bf29c0e0649d6d0f3d2
2021-03-06 21:00:09 +00:00
Umherirrender 35ee72248c Move userTalk-constructive icons from root to modules
Store all SVGs in the same folder.

Change-Id: I0b2205e1e894bccae3527a6544a9c370b13ffcec
2021-03-06 19:01:48 +00:00
Vadim Kovalenko d14b4161a0 Avoid using LogEntry::getPerformer in favor of getPerformerIdentity
Bug: T274329
Needed-By: I1921ba8586e2d56a9669803532ade5ee2c4c3b56
Change-Id: Ide485fb8f9a0a22d2d7fc7a3bbbe458f603db393
2021-02-25 14:17:22 +00:00