Commit graph

108 commits

Author SHA1 Message Date
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
Vadim Kovalenko 3a9fccd270 Avoid using LogEntry::getPerformer in favor of getPerformerIdentity
Bug: T274329
Depends-On: I3dadb20f076494f7b46f0647ea3a8bfbbdaa59da
Change-Id: I30decf50ff20052540dd7dafa2d1077c90aa2a63
2021-02-19 07:54:45 -05:00
Reedy 6cbddccd6b Use updated CheckUser Hooks class
Depends-On: I3f66b660f9d59c0e88b182c9b06ee8cec994348e
Change-Id: I9ba257b9795d1860eff27a7a68a16524deaae6d9
2021-02-11 19:31:13 +00:00
James D. Forrester bd6f715c0c Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: Id90c56ca5cd1439d41b48e49de2b44c3adb69e4d
2020-12-17 18:24:11 -08:00
libraryupgrader cb63494eed build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).

Change-Id: Ie0082065db3abe1f740a0b983ece371ea2d3cfd0
2020-11-04 14:30:29 +00:00
Taavi Väänänen d46356dd73 Allow restricting log entry thanking to subtypes
This commit adds the technical possibility to restrict ThanksLogTypeWhitelist
to only log subtypes like 'rights/rights' in addition to log types like
'rights'.

Bug: T191599
Change-Id: I31fb591dda2e5ecbfb5ac07352d3356134533540
2020-08-21 12:01:24 +00:00
DannyS712 83fb704391 ApiThank: Send thanks logs to CheckUser when extension is enabled
Bug: T252226
Change-Id: Ifff1ca8071e0df161f7f212303469498340dd625
2020-07-03 05:03:28 +00:00
DannyS712 4d18a1e093 BeforeSpecialMobileDiffDisplay hook: Only accept RevisionRecord
Compatibility was added so that MobileFrontend could switch from
Revision to RevisionRecord, but now that the switch has occurred no
need to keep checking to see if a Revision is being passed

See [1] for the MobileFrontend change that required compatibility

[1] e42c52527b

Bug: T246284
Change-Id: Ie320454a0e90d7f98004a3b776010aff784bbf4d
2020-06-30 08:31:50 +00:00
DannyS712 317e0a6810 Hooks: Update to use DifferenceEngineViewHeader
Bug: T255769
Change-Id: I9b8f0359c3478fe1c028b47756d88062c2abcec8
2020-06-24 00:42:58 +00:00
DannyS712 1826d8984d Use new HistoryTools and DiffTools hooks
Extension requires 1.35+, so the hooks are available

Bug: T255494
Bug: T255495
Change-Id: I334928ebd081d53a7d95466e6c4b75715b941ec4
Depends-On: Ib2ab2e26a95affdd1dfa6b945f752157580ea2d3
2020-06-16 00:40:57 +00:00
Umherirrender e1cd44f28d build: Bump phan to 0.10.2, remove taint-check
Declare a variable which is not set in all branches for static code
analyzer, but at runtime it is

Change-Id: I851bdbf9dc092d5213d74a03427b783f61e8946a
2020-05-31 17:05:43 +02:00
DannyS712 0917ab16cc Reduce use of Revision objects in ThanksHooks
Can't remove entirely, since the hooks don't have replacements yet,
but can prepare for the switch while waiting and remove use of
Revision objects to the extent possible

Bug: T251073
Bug: T251593
Change-Id: I5f9e41d58c8d1693b23c84bbfe085d3b33ad0c75
2020-05-27 23:06:13 +00:00
James D. Forrester 84448301ef Use QUnitTestModule instead of deprecated ResourceLoaderTestModules
CI already ensures that MobileFrontend is loaded alongside Thanks, so
the defensive check in the code isn't needed; ext.thanks.mobilediff is
defined statically, it's just injected into the page dynamically in the
onBeforeSpecialMobileDiffDisplay hook handler.

Bug: T232875
Change-Id: I5612a9be65f4d4adf4912645856540dbb04d2b34
2020-05-11 19:43:17 +00:00
Reedy 7768edc7ec Update to use Flow\Notifications\FlowPresentationModel
Change-Id: I419af406f86c495d1448d2be07f8e891bdd7e47a
Depends-On: I25c65cbbc6d43dae7b2515a7b93f02b7180ba89f
2020-04-18 00:19:57 +00:00
DannyS712 859f6a4b57 BeforeSpecialMobileDiffDisplay hook: Prepare to accept RevisionRecord
So that MobileFrontend can pass Revision objects without breaking

Bug: T246284
Change-Id: I2adb63bac52bd721ebffd06082f9c553f50d5cd8
2020-04-15 04:48:50 +00:00
ArtBaltai b6b2c3dfdb Replace usage of deprecated Page in favor of WikiPage/Article
change comment for Page argument

Bug: T239975
Change-Id: If3243d59b129360e1790c68ea193de27d1943462
2020-02-21 08:49:12 +00:00
libraryupgrader a54db3f84e build: Updating composer dependencies
* jakub-onderka/php-console-highlighter: 0.3.2 → 0.4.0
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.1

Change-Id: If99754eddc6ba783278142fdd880e39211dd60af
2020-01-31 12:20:18 +00:00