Commit graph

151 commits

Author SHA1 Message Date
Kosta Harlan f2220b151e
Hooks#onLogEventsListLineEnding: Don't add link for temp users
Why:

* Temp accounts cannot thank other users, so do not add the "thank" link
  in log entries.

What:

* Change condition to check if a user is not named, rather than if they
  are anonymous
* Add an integration test to verify the behavior for anon, temp, and
  named users

Bug: T375209
Change-Id: Idb772a3072a6dc8a9d052cebb306b558f49caf31
2024-09-23 22:21:03 +02:00
Fomafix 139c83b1a9 ApiFlowThank: Replace deprecated User::newFromId
Change-Id: I857ce647a1374600c952107b92c3c35440c83b6c
2024-09-07 10:30:10 +00:00
jenkins-bot ebd1740377 Merge "Use LinkTarget in LogFormatter::getPreloadTitles override" 2024-07-26 18:49:28 +00:00
Umherirrender 2b39d8f009 Replace deprecated LogFormatter::newFromEntry
Change-Id: Icd3316b7f475a09390be8787fae6a8b63dcd6418
2024-07-21 07:28:09 +00:00
Umherirrender b26c899229 Use LinkTarget in LogFormatter::getPreloadTitles override
Change-Id: I4748927e8656346f7912deec05ba5acaafa44ce9
2024-07-14 22:56:40 +02:00
Umherirrender ba8b0ffa81 Add BatchLookups on HistoryPager and ChangesList
ChangesList is used on Special:Watchlist and Special:RecentChanges
HistoryPager on action=history

Bug: T367175
Change-Id: I12b92a94859300ab3bedd81c0e2399e203c1ad0f
2024-06-11 22:11:30 +02:00
Umherirrender 0da96a7000 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: If99e2c98969579306c7fdc626658bec5d6e26b5d
2024-06-10 22:00:22 +02:00
Fomafix 41e2942d94 Use namespaced PHP classes
Change-Id: I98890c4a41c913b5e20c97c9ad1deaa4c2b4fe5b
2024-05-11 08:58:37 +00:00
Jon Robson b119a36f62 Special:MobileDIff no longer exists so remove associated code
Bug: T360389
Change-Id: I0cd7e1269beb707b8e98d37e824dc260c8e670ea
2024-04-25 12:10:28 -07:00
Piotr Miazga 7b750929a8 Move Echo hooks to new EchoHooks handler that has no dependencies
Echo hook BeforeCreateEchoEvent is triggered very early in
Setup.php. This causes all dependencies of Thanks/Hooks to be
initialized. One of the places that is affected is the `addWiki.php`
script that tries to redefine the RevisionStore service, but cannot
due to fact it's already initialized.

Both Echo hooks (BeforeCreateEchoEvent and EchoGetBundleRules) do
not require any dependencies, and due to fact that one of those is
initialized early, let's move them to a separate small EchoHooks
class that would handle Echo specific logic.

Bug: T358236
Change-Id: I0e348872ba5dc313325e3f4f296fd84bfb2c785b
2024-04-04 16:39:50 +02:00
Fomafix 4bf74e6415 Inject services in Hooks and MobileFrontendHandler
Hooks::canReceiveThanks is still static, because it is also used in
MobileFrontendHandler.

Change-Id: Idff34ebce914ad37bcaea8de04b3ef5e01d7d98d
2024-03-14 20:27:26 +00:00
Amir Sarabadani 9d4ccf0db4 Switch to ICP and stop using DBAccessObjectUtils::getDBOptions()
We are getting rid of this

Bug: T354194
Change-Id: I70c613993647f77259ef0ccf7570e3560b66ef56
2024-02-29 09:15:20 +00:00
jenkins-bot 6f84512327 Merge "SpecialThanks: Document generated i18n keys" 2024-02-27 15:44:53 +00:00
Ed Sanders 993afb7439 SpecialThanks: Document generated i18n keys
Change-Id: Iab2de23b68475d17d2a488001a8424b7258acd3e
2024-02-23 16:34:49 +00:00
Bartosz Dziewoński 3e3e2a40f2 ThanksQueryHelper: Add ->caller() to query
Change-Id: Ifdd1c952fb1bcb4bd03406e5567a19810503265a
2024-02-09 21:31:31 +01:00
Umherirrender 40e4bead61 Avoid fatal when thanks ip via Special:Thanks
Bug: T353466
Change-Id: Iac810dc1929b6473c15ec231df0a8f17790991dd
2024-01-23 22:28:02 +01:00
Umherirrender f5db77c750 Use namespaced classes
This requires 1.42 for some new names

Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I1b433ab02231087e0f84a734092751ce2cf28b2c
2024-01-04 22:22:56 +01:00
Ed Sanders 1e77d0163f Document generated messages
Change-Id: I89101839f7c056cdd509e000fb0bbc8573f97515
2023-11-30 11:52:11 +00:00
Fomafix bfe320c2ea Move onBeforeSpecialMobileDiffDisplay to class MobileFrontendHandler
This avoids a hard dependency on extension MobileFrontend.

Change-Id: I7dd3972145c1fbffae9bc58ed0d3157310a53354
2023-11-16 14:46:27 +00:00
Fomafix af5658ae05 Implement hook interfaces in Hooks
* BeforeCreateEchoEventHook and
* EchoGetBundleRulesHook from extension Echo and
* BeforeSpecialMobileDiffDisplayHook from extension MobileFrontend.

Change-Id: Icede5f70f988957f245fac1984a63f01fa1d0f44
2023-11-08 11:42:01 +00:00
jenkins-bot 337ff45130 Merge "Replace global config variable" 2023-11-08 04:17:32 +00:00
Fomafix 212c72d5e7 Replace global config variable
Change-Id: Ibe5c6d077ebd1413359c1bcb4b16388874f3f5ea
2023-11-07 21:09:55 +00:00
Fomafix 49beda6416 Replace deprecated global function wfGetDB()
Bug: T330641
Change-Id: I79955bb707e73ef6162ca14d30455732ef12f1f2
2023-11-07 20:40:06 +00:00
Jon Robson f47a195079 Minerva: Thanks should use Codex classes for thanks link
Without this Thanks button will be unstyled on Minerva skin.
In the desktop Minerva diff page, the button should be a progressive button
for consistency with Special:MobileDiff

Testing:
* Check diff mode (AMC disabled)
* history page (AMC enabled)

Bug: T345768
Change-Id: I038cfab627eea2fdf558accbf390a8d2d02153a1
2023-10-19 21:17:08 +00:00
Martin Urbanec 9cef38e80f IP Masking: Do not allow temporary users to thank other users
It has been decided to not allow temporary users to thank
other users (see task). This is because the transition
between anonymous and temporary account is nearly invisible,
and it might be confusing why the thanking ability appears
and hides.

Bug: T345679
Change-Id: I62e67327c9a80b3da9e98a2dccdd4ec2051f3026
2023-10-03 22:23:02 +00:00
Umherirrender a5fc01da56 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T338457
Change-Id: If844970f0c8d8f09d0de2a2140b080d1292530a1
2023-09-28 23:32:52 +02:00
Umherirrender 3d1164f9a4 Use UserFactory::newFromUserIdentity/Title::castFromPageIdentity
As the revision is a local revision, the user identity can be used to
build a User. Not needed to use the id.

Same for the title/page id, where a PageIdentity already exists. Not
needed to use the id.

Change-Id: Ia088d964f75fb46bd0848c9aba8f5bc97ad7a067
2023-08-21 22:11:12 +02:00
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