Commit graph

127 commits

Author SHA1 Message Date
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
jenkins-bot 388b63445d Merge "build: Updating mediawiki/mediawiki-phan-config to 0.9.0" 2020-01-02 09:04:54 +00:00
Fomafix 5e6f6d8d0f Use $this->getConfig() instead of global variable
Change-Id: Id368f934087b97d33d6404ceed5099034973509a
2019-12-28 21:37:59 +01: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
DannyS712 9f495fcedb Don't allow thanking system users
Bug: T237356
Change-Id: I3d7968276a59a66ed4d1931b03310e571d070167
Depends-On: I73f25a10df2c28a69f612eb1db3e91b7125383d9
2019-11-05 22:50:12 +00:00
Umherirrender b8e317d9fb build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Depends-On: I381718e52f8764544adec011ca8ca7dde6b489a4
Change-Id: Ia7e7b34b5d263317215d6d35530fe48acec9c858
2019-11-05 18:46:52 +01:00
Derick Alangi 1acb40ee42 Avoid using deprecated Revision class constants, use RevisionRecord
Change-Id: I1932a66c5e6d815680d79770116111266c9db9e3
2019-10-21 15:12:06 +01:00
David Barratt c773e01787 Read the block status from the replicas for the 'thank' link
User::isBlocked() by default reads from the replicas;
PermissionManager::isBlockedFrom() reads from master by default. The
'thank' link is not critical so it should be read from the replicas.

Bug: T231617
Change-Id: I262ed63df82e97862a8dfc8da49fc09465ac8507
2019-08-30 13:28:59 +01:00
Matěj Suchánek 2c94ba17ed Replace $wgUser
Bug: T159299
Change-Id: I023c46a99b96ae9141ac75830c03979e90263ae0
2019-08-27 14:20:39 +02:00
jenkins-bot e044574c08 Merge "Improve EchoCoreThanksPresentationModel" 2019-08-06 23:14:51 +00:00
Matěj Suchánek 8a05d03f67 Improve EchoCoreThanksPresentationModel
Call EchoEvent::getRevision to use cache.

Don't hide notification about thanks for log
when just the comment was hidden.

Also simplify code using ternary ?:

Change-Id: I279291727ecd404db18dd68699744284e17a27ef
2019-08-06 10:28:15 +02:00
Martin Urbanec 003172c157 SECURITY: Do not let users thank for a log entry if actor was deleted
This prevents users from accessing information about the actor
by abusing uselang=qqx and the thank button.

Bug: T224240
Change-Id: I3f42d56874776cfa0c9d364217f43253efc14782
2019-07-11 15:39:16 -07: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
libraryupgrader e0e2c20127 build: Updating mediawiki/mediawiki-phan-config to 0.5.0
Change-Id: If0aa36ada0eb4b071ce5fe704c4d0c5cff21c4eb
2019-03-10 22:32:43 -07:00
Derick Alangi f9082d1df6 Remove "return true" legacy behavior from hook handler functions
Change-Id: I16224ee276c5e76ff475bce0e1f2c29bf9c7385d
2019-02-02 20:34:32 +01:00
Matěj Suchánek 97e95d5559 Use ExtensionRegistry instead of class_exists
Bug: T183096
Change-Id: Ida0278326291e7bd52cbebd36d1b0a775380043e
2019-01-01 17:07:27 +00:00
jenkins-bot 5d5b82ad65 Merge "Thanks/thank: Add tests for thanked cookie and getUserGender()" 2018-11-16 18:15:38 +00:00
takidelfin 957ee53679 Thanks/thank: Add tests for thanked cookie and getUserGender()
Added two new tests: thanked cookie and gets user gender. First uses jQuery cookies and second uses Sinon fake server

Bug: T160267
Change-Id: I8f5dad9c90e930d557e86acb4b175ec549849e7a
2018-11-16 17:50:58 +01:00
jenkins-bot ae16570c31 Merge "Minor fixes to improve readability and CC" 2018-11-14 20:52:43 +00:00
Alangi Derick f3d1aac4db Minor fixes to improve readability and CC
Minor code formatting. CC stands for Coding Convention.

Change-Id: I5c95d03df7a9362ff7ab71c0aabbfb9ed7e9ce65
2018-11-10 22:06:01 +01:00
Rafid Aslam 55ca549068 Change HTTP links to mediawiki.org to use HTTPS
Several links that link to mediawiki.org still use
"http" protocol which isn't a safe protocol. This commit
changes http links that link to mediawiki.org to use
"https" protocol instead.

Bug: T189687
Change-Id: Ibb5f019e21f5d6ca0b4c40138dab22ae43e9004b
2018-10-30 23:50:40 +07:00
jenkins-bot d6bc51d691 Merge "Fix postid parameter on Flow thanks page" 2018-10-25 11:09:56 +00:00
Mahuton 037a85f623 Fix postid parameter on Flow thanks page
Flow: fix postid parameter

Bug: T191442
Change-Id: Ia031e62a5c6c4a0781cf877f2ca036a4a2af6e4e
2018-10-19 10:56:25 +02:00
Roan Kattouw ebfee91e80 Use User::isBot() rather than rolling our own
We were manually checking for the 'bot' group, but MW core has a method
for this that's more comprehensive.

Bug: T205224
Change-Id: Idce475ce10a21c5593d366470eede7d8dd1f6dfe
2018-10-02 17:29:10 -07:00
Stephane Bisson 8daf575067 Allow thanking discontinuous revisions
Modify the revision continuity check to be
resilient for pages with discontinuous histories
while still catching diff that span multiple
revisions.

Bug: T186470
Change-Id: If9614f6e3e278367530e9a4f5054ac370d1c0699
2018-09-24 16:32:48 +00: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 478d731771 Remove unneccessary @suppress after phan-taint-check-plugin upgrade
Bug: T201565
Change-Id: Ib35e55e5bebbb7dc6ca8ef4f08b519ec2065037b
2018-09-01 19:59:16 -07:00
Framawiki fe8a3916c2 EchoCoreThanksPresentationModel: Avoid re-implementing getThankType()
Change-Id: I48aa7593cec275ed4e38b22b36a2a998c7202cdc
2018-08-30 02:20:00 +00:00
jenkins-bot defbe0f421 Merge "Suppress taint-check-plugin issue" 2018-08-25 04:38:12 +00:00
Amir Sarabadani 8ca5464a16 Security: Disable thank when the user is globally blocked
Bug: T151910
Change-Id: I3f39dd32cb76d1a20c8711d5de88e8fcbc36507d
2018-08-23 11:37:34 -07:00
Umherirrender f8d82481a8 Suppress taint-check-plugin issue
Suppress the issue with a hint to the task (T201565) allows
to enable the voting jobs and avoids new issues in the future.

Change-Id: I88d09923d1e1a59e285513e56985989fabbb4505
2018-08-23 11:36:19 +02: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
Matěj Suchánek 12c2cc0f92 Correctly bundle thanks notifications for logs
Thanks for logs are created with 'logid' extra param. Param 'id' was
never used and was added accidentally.

Bug: T192041
Change-Id: I1f7e0d53c674509200fc8c704f99fd3d8197636b
2018-05-29 16:18:29 +00:00
jenkins-bot fc4893d833 Merge "Use new Special:Log?logid=xxx URL for notification link" 2018-05-04 05:59:47 +00:00
jenkins-bot a67ec2031d Merge "Update icon to latest from OOUI" 2018-05-01 20:33:11 +00:00
Sam Wilson 862c737aa0 Fix canRender and add greppable messages for dynamic keys
This fixes issues raised in https://gerrit.wikimedia.org/r/#/c/416207/4/includes/EchoCoreThanksPresentationModel.php

Bug: T192711
Change-Id: I5e654f5ae9480aa048326c067129fafd430f0515
2018-04-24 06:38:26 +08:00
Sam Wilson 0fa3196e8b Use new Special:Log?logid=xxx URL for notification link
Avoid redirecting via Special:Redirect/logid/xxx with the new
logid parameter to Special:Log.

Bug: T191608
Depends-On: I5f2e52531cd2ba617a25570e40aa8c5168e284d9
Change-Id: Iffb1b0d9cc44fde69aa53f32d4a066cd3a10c5f4
2018-04-23 12:40:54 +08:00
Ed Sanders b319ae80b3 Update icon to latest from OOUI
Also use same name as in OOUI (with color modifier).

Bug: T183749
Change-Id: I1a1e47398beb5527e3d4e0426691b6b5dc5f9f5e
2018-04-13 18:08:59 +01: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
Kunal Mehta e696cba57f Add phan configuration
Change-Id: I6d0a0823404e5e50819ae0997b7d2c5267a4e144
2018-04-09 00:12:28 -07:00
Umherirrender 145b1f1772 Declare nullable argument only in @param
The $oldRev could be null, but when set the null in argument list,
it is an optional parameter and the following argument $user must be
optional too. That is not needed here.

Change-Id: Ia7c1c44b29b191dc602513e07b90d3e2415d3a5d
2018-04-05 12:45:23 +02:00
Sam Wilson 56dfaa8555 Add thanks links to Special:Log for log entries
Only log entries that were associated with revisions were
being thanked. This adds other log entries (if they're of
a whitelisted type still).

Bug: T187485
Change-Id: I9c644590b52bce9b04c7c655dd197c1b78a83777
2018-04-03 06:20:56 +00:00
jenkins-bot 431ca7785b Merge "Add GENDER support to thanks-thanked-notice" 2018-03-25 06:02:57 +00:00
jenkins-bot 3dbf781571 Merge "Add revision-thanking links to some log entries" 2018-03-23 01:09:20 +00:00
Matěj Suchánek ac9f8908ca Add GENDER support to thanks-thanked-notice
Change-Id: If23ce8d7ee8ff1edf484c217a70aa34046590fd6
2018-03-22 08:35:26 +00:00
Sam Wilson 2059e3ff4b Add revision-thanking links to some log entries
Many log entries are associated to (exactly one) revision,
and for these (only, and only where the log type is
whitelisted) we add a thank-link that behaves exactly
as the thank-link on diff and history pages.

Bug: T189752
Change-Id: I5f4e84c65d4fe2d95b20cdb3c3f9522ad3e5f422
2018-03-22 11:57:55 +08:00
Brad Jorsch c3f508cdd8 Update for the actor table change
Core change I8d825eb0 begins the process of changing core database
tables from using xx_user and xx_user_text fields to using xx_actor.
This updates the extension to continue to function during and after the
transition.

Bug: T167246
Change-Id: Ib84a5a7a9f80fa321f7482d4c27c5f58add47230
2018-03-20 15:29:32 -04:00
Sam Wilson 30e582bd96 Add support for log-thanks to Special:Thanks
A new "Special:Thanks/Log/123" subpage format is added for
sending thanks for the given log entry. The 'Log' part of the
subpage is case-insensitive.

The form field labels are removed because the fields are hidden
and need no labels.

Bug: T186920
Change-Id: Ic2279d9a6dc170d1eeee519392d3a930a37bc2ec
2018-03-19 10:59:20 +08:00
Reedy 2735468029 Revert "Add revision-thanking links to some log entries"
This reverts commit 9f393ef9dd.

Change-Id: Ie76fef8dc25b1134f1f60da50a87b00115154041
2018-03-14 21:49:25 +00:00
Sam Wilson 9f393ef9dd Add revision-thanking links to some log entries
Many log entries are associated to (exactly one) revision,
and for these (only, and only where the log type is
whitelisted) we add a thank-link that behaves exactly
as the thank-link on diff and history pages.

Bug: T186763
Change-Id: I2af380d5cb06f19ef9eb5b232d95ad87379b5d9b
2018-03-13 09:33:15 +08: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
Sam Wilson 499dc04960 Remove a coding-standard exclusion
Add some parameter comments etc.

Change-Id: Ifb663c69711036ea01cb2b90acaa81d22c74a3af
2018-02-12 09:26:19 +08:00
addshore d2c420878b Import MediaWikiServices in ThanksHooks
Bug: T186618
Change-Id: I62de4a2a88b81d27c12b364848cd237236484aa0
2018-02-06 17:01:25 +00:00
Sam Wilson 2e7e5e0190 Move classes to includes/ and rename some to match class names
For conformance to coding standards. This removes an exclusion
from the phpcs config.

Change-Id: I1481a3e7e68a81daf310ea3c7bf9dc48cdaf140b
2018-01-30 10:32:03 +08:00