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
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
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
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
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
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
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
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
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
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
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
- 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
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()
Bug: T277818
Change-Id: Iacc258705c4517c958a2568e47ba4f43963acc2e