Commit graph

71 commits

Author SHA1 Message Date
Jon Robson 31bcd72898 Do not use deprecated MobileFrontend library, use Codex
Additionally:
* Begin progress of switching codebase to ES6

Bug: T348807
Change-Id: I22d46f0d0d9f5ace7291f4ddedfc515ef69d0835
2023-12-12 17:24:46 +00:00
Fomafix 5c73e6ddb5 Use MediaWiki\ResourceLoader\ImageModule instead of ResourceLoaderImageModule
The class name ResourceLoaderImageModule is deprecated since 1.39.

Change-Id: I56a66756b5601fbc4e96951a1f6b9a96e4c55546
2023-12-01 12:14:25 +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
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
James D. Forrester 9afd171d43 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I51fd9ae1374d0f25b9373e114cd18c8466d0e586
2023-08-19 14:10:09 +08:00
bwang cddf22dbda Update icon resource loader class due to icon changes in MobileFrontend
Bug: T343053
Change-Id: I3bde8e4ef5b00ab5b56e0f7925b484ee4809abec
2023-08-04 16:53:44 +00: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
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
Bartosz Dziewoński dc8f07d2af API tests: Assert error codes, not error messages
Depends-On: I752f82f29bf5f9405ea117ebf9e5cf70335464ad
Needed-By: Ie17987991d1e9a0d77da97e3a81fe0a21c6d7866
Change-Id: I353e34d81afaa06750f8725181c808fabcebea42
2023-04-26 17:55:21 +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
jenkins-bot 1702d0724b Merge "Adds the ThanksQueryHelper service" 2022-12-16 01:06:25 +00:00
Jon Robson e85b2c6996
Adds the ThanksQueryHelper service
Bug: T325094
Change-Id: I3a14d255546c12655dc4492194a07b0d205f0534
2022-12-15 16:11:28 -08:00
Jon Robson 5109079f52 Enable thanks JavaScript on mobile
On mobile mode, the thanks link is currently hidden on the history
page and the module is silently removed on mobile. Add the module
to those pages

Bug: T324723
Change-Id: I5286e80f9dd683ba55b03664dc31de77c19722b7
2022-12-12 15:38:17 -08:00
Thalia 1bbfae82d8 Bump required MediaWiki version to 1.40.0
This is needed  since d287af1af1,
where special handling for global blocks is removed.

This is because global blocks are now found via $user->getBlock(),
since I92a426745a9a4cb05beb0d546c238c2826a2b615.

This change required a hook added in 1.40, which allows extension
blocks to be reported correctly: I1c20e7e62e0f2b453735689e3dc543164b5fd067

Change-Id: I48a14cc13b10e2cb0a7f3b71cdde0f8a106b7e6b
2022-11-14 17:49:38 +00:00
Taavi Väänänen e50dd559d2
Update defaults to allow thanking of rights/rights only
This ensures that people can't thank autopromote entries.

Bug: T191599
Change-Id: I64ed219891e61822614367d17c17cb00cb1c8bd7
2022-08-22 15:36:19 +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
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
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
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
Reedy 6cbddccd6b Use updated CheckUser Hooks class
Depends-On: I3f66b660f9d59c0e88b182c9b06ee8cec994348e
Change-Id: I9ba257b9795d1860eff27a7a68a16524deaae6d9
2021-02-11 19:31:13 +00:00
Niklas Laxström 4f432261e9 Remove unused jquery.cookie dependency
Change-Id: Id9fca11c5f4129b757e6b16b868938766b9c57eb
2021-01-13 12:29:58 +01:00
jenkins-bot e379078b5b Merge "Enable thanks from pagelang and upload log" 2020-09-22 20:02:36 +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
Matěj Suchánek 850d8e29f3 Enable thanks from pagelang and upload log
"Page language change" is an occasional administrative
action, for which thanking should be possible.
And thanking for an upload is same as thanking
for creating a page.

Bug: T254992
Change-Id: Id4ecc6e11968e51b166e80f30e636da902857dd7
2020-06-10 10:21:43 +00:00
Gergő Tisza 3d17c58922 Use mw.cookie instead of $.cookie
Bug: T254024
Change-Id: If487ef4d14f308fd6da0d6b938e35dc68dca5b5e
2020-05-29 19:44:12 +00:00
jenkins-bot 3a74c5d2d5 Merge "Convert to manifest_version 2" 2020-05-12 16:09:19 +00:00
Reedy ba2603977b Convert to manifest_version 2
Bug: T252470
Change-Id: I677c41a5dddb03c8224e86bf738c0ac8d85b1647
2020-05-12 02:05:37 +01:00
James D. Forrester e8db596dfa extension.json: Fix name of QUnitTestModule
Change-Id: If54638bedb347e4b7b58d932d0c625acb44782b4
2020-05-11 14:42:48 -07: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
James D. Forrester b1597235d8 extension.json: Alphasort hooks
Change-Id: If252a261e14613ac341e70ac572ad057e737143e
2020-05-11 12:37:38 -07:00
James D. Forrester fdc080873f extension.json: Simplify hook links as we only have one method per hook
Change-Id: Ie952f5c75acf862d1342f6178c8d49678f9cb471
2020-05-11 12:37:36 -07:00
Timo Tijhof a20b708ce7 Remove redundant dependency on 'mediawiki.notify'
Bug: T233676
Change-Id: I8373dc651df227fc3d2319d2ec6b8c4d47dacf1c
2020-04-22 18:34:06 +01:00
Reedy 7768edc7ec Update to use Flow\Notifications\FlowPresentationModel
Change-Id: I419af406f86c495d1448d2be07f8e891bdd7e47a
Depends-On: I25c65cbbc6d43dae7b2515a7b93f02b7180ba89f
2020-04-18 00:19:57 +00:00
jdlrobson 7a7f751b42 Create mobile thanks using the mobile library
The thanks icon had styling issues as it didn't use the mobile
icon and button fundamental components.

The icon should also be inside the button, the element should not
be both a button and an icon.

Bug: T229440
Change-Id: I0136466fe1452f904961b89ae7677fc1a511adab
2019-09-13 19:23:49 +00:00
Ammar eae0f237df Remove unneeded CSS for thanks toast link
Minerva now provides default styling for these links.
Also removing 'grunt-stylelint' package as there are no
CSS/LESS files in this extension any more.

Bug: T232102
Change-Id: I4e8b44d3159ab4a87103fa8471c7b1b145ac6016
2019-09-06 09:23:12 -07:00
Timo Tijhof bfa2bd3f72 Merge jquery.findWithParent.js into 'ext.thanks.flowthank'
Never loaded directly as entry point, and only used by one module
as dependency. Does not need to be its own module bundle.

Bug: T202154
Change-Id: I8bfcdc82f96fac6e3e269fcef351a822acd860bd
2019-08-05 16:09:10 +01:00
Thalia 810de9afbd Allow partially blocked users to use Thanks
Only prohibit users from using Thanks if they are blocked from the
associated page. This allows partially blocked users to use thanks
most of the time.

It also allows blocked users to thank on their own talk page, if
they are allowed to edit it, even if they are sitewide blocked.

Bug: T221371
Change-Id: Ic99ec38ea200e806963951b2dd67e56ecde63752
2019-05-22 22:05:33 +01:00
Matěj Suchánek 08f769b3b2 Enable thanks on Page creation log
Bug: T213660
Change-Id: I1edf7bc8d1d2d604034a07069f0f39fa30bf36ae
2019-02-25 08:03:44 +00:00
jdlrobson 4f276041f4 Add client side click to cancel on thank
When the thanks button is clicked a thanks will be
queued, that the user can cancel by clicking "cancel"
before the action is completed.

This should help the majority of users experiencing
accidental thanks.

Bug: T63737
Change-Id: I807f729c1b1a9e9b5952685bb18f540f81d70f47
2019-02-08 17:31:20 -05:00
Rafid Aslam b7cd517fb6 Move all apihelp translatable messages to separate files
Should be merged along with
Ie566f9b0b6ba267470c01f17c3f4ea74482e2d2d

Bug: T189982
Change-Id: Id3d44fe0e7884276f7c81253f6b765984f5c9945
2018-11-21 07:00:55 +07:00
jdlrobson 5927de143e Fix indentation in extension.json
Follow up to I82ae596330aff8387653c65a6bab5ff729641a80

Change-Id: I849599e57bb546d99c1435222bc183ab8e5971c0
2018-08-16 10:18:20 -07:00
jdlrobson a6fa3c4977 Do not use PNG for thanks button
Instead use mediawiki.ui and ResourceLoaderImageModule

Other changes:
* Add gender support to thanks-button-thanked

Depends-On: I0745e112d11026ed59d8daca990b313305cd094a
Bug: T198151
Change-Id: I82ae596330aff8387653c65a6bab5ff729641a80
2018-08-09 17:13:21 +00:00
C. Scott Ananian edd6818eb9 Replace uses of deprecated Language::truncate()
See I2291c69d9df17c1a9e4ab1b7d4cbc73bc51d3ebb for the anticipated
hard-deprecation of this method in core.

Bug: T197492
Change-Id: I5d4ec96afe82910ffd18377b5f5f94405f73e9eb
2018-06-15 20:24:32 -04:00
Kunal Mehta b8b892bb98 Hard depend upon Echo in extension.json
This extension is useless without Echo, and the API modules already
disable themselves if it's not installed. Just absolutely require Echo
to be installed.

Change-Id: I653eea78668bfe0875bc5a33e2d45607106d4ee5
2018-04-11 01:00:30 -07:00
Niharika Kohli 896ea17303 Allow thanking for flow-lock-topic and flow-restore-topic
Bug: T191482
Change-Id: I3f5bd11d0c02ee25b305c73a708f995cb59e4624
2018-04-09 17:40:38 -07:00