Commit graph

23 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
jenkins-bot 388b63445d Merge "build: Updating mediawiki/mediawiki-phan-config to 0.9.0" 2020-01-02 09:04:54 +00:00
Fomafix 1a4d901caa Remove bad tab in source code
Change-Id: I868b36dadb2ad0166e94277eda9993fe38cfec37
2019-12-28 20:55:52 +01:00
libraryupgrader 5e473e662d build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: I6b7b79e697d7555bb1316fa3d4f821f7a81e02e4
2019-12-28 17:12:46 +00: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
Derick Alangi ef903f25d7 ApiCoreThank: Replace deprecated Revision::* methods
Depends-On: Icfc85167a636bef95daab236ab80113c1a3cf41b
Change-Id: I31d819f4453032da8deb117254b954fba058e0a3
2019-05-08 00:16:32 +01:00
Framawiki 801eed16b9 Better message when thanking on page creation
Add a new "revcreation" extra param to the stored echo event, that is set to "true" if it's a page creation.
Create notification-header-creation-thank message.

Bug: T201507
Change-Id: I80b206b1d24d53c9a60725bc25318e31f083aef0
2018-09-09 11:46:39 +02: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
Max Semenik ed087b044c Reintroduce the API to thank for log entries
Originally introduced in b84eedc74e, it was reverted for security concerns.
New changes:
* Instead of bundling the log summary with notification, load it on display
* If the log event has been suppressed after the thanks for it has been sent,
  silently delete the event to prevent the confusion of linking to something
  zapped.
* Keep the 'already sent' cache key compatible with old format
* Validate the log id in the API
* Change ApiCoreThank::getRevisionFromParams() to ApiCoreThank::getRevisionFromId()

Bug: T186855
Bug: T188791
Depends-On: Ic5e9db0def857d9dcecbd06bf081c8c83712c1ea
Change-Id: I03aea7d9f4dfa0fe49639c53968deabf89999d2d
2018-03-06 13:08:47 +08:00
MaxSem 3b2397fea9 Revert "Add support to the Thanks API for thanking log entries"
This reverts commit b84eedc74e.

Bug: T188791
Change-Id: If55ed6cbb5da34c0034da3cc564c6a8ff82448d2
2018-03-02 22:59:20 +00:00
Sam Wilson b84eedc74e Add support to the Thanks API for thanking log entries
Add a 'log' API parameter (for the log ID to thank), and add
a whitelist config variable for specifying which log types are
thankable.

Bug: T186855
Change-Id: I58ae90c9729c0066f952e90fca2cf99b029d0d9b
2018-03-01 14:57:57 -08:00
Sam Wilson 78831d2b68 Rename files and classes in preparation for adding log-thanks
Bug: T186855
Change-Id: I20f5d200c33e395aca9489b73d0ed9b1d0ad5b8c
2018-02-21 12:49:21 +08:00
Renamed from includes/ApiRevThank.php (Browse further)