Commit graph

1614 commits

Author SHA1 Message Date
Andre Klapper b67bd9663c Use explicit nullable type on parameter arguments (for PHP 8.4)
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I251cb37401c37242f493816b6f70ab61a64a4c32
2024-11-14 23:50:10 +00:00
Ammarpad bde121403f Handle hidden revisions in user page edit notification
Bug: T378799
Change-Id: Ie68e024625c640f46e6af21a2829b33fbd57ec8a
(cherry picked from commit b80f4294b5)
2024-11-04 23:27:28 +00:00
Reedy 577f70803c SpecialNotificationsMarkRead: Don't pass null to explode()
Bug: T377920
Change-Id: I426c76dbf2e8da4563e93fefe6bd628faa0e13b7
(cherry picked from commit a76cc44a60)
2024-10-23 18:06:38 +00:00
Umherirrender 7e5eceb5a6 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: Iab065a2005acccfe05cc827fdafc7861687d053d
2024-10-20 00:55:03 +02:00
Umherirrender f95c0cc11d Pass function name to HttpRequestFactory::create
Change-Id: Ie48127731f0731f780e153f6aacce25961acc3ed
2024-09-19 22:48:37 +02:00
Gergő Tisza 89a3a1fc57 DiscussionParser: Do not create User objects from subpages
Bug: T375212
Change-Id: Id409a4f9adcda840400e529db72eb696ec55b3f4
2024-09-19 16:06:00 +00:00
jenkins-bot cae6fc46dd Merge "Replace deprecated LinksUpdate::getAddedLinks" 2024-08-23 20:06:58 +00:00
Dr4goniez 14b06b78e5 Consistent Casing for "iconUrl"
Replaced all occurrences of "iconURL" in the extension's repo with
"iconUrl" after spotting a typo in `mw.echo.dm.NotificationItem.js#13`,
"iconUrl" (find the correct "iconURL" in `mw.echo.Controller.js#394` in
the diff). Thankfully the typo was only in the documentation block, but
given the casing of other config object properties like "primaryUrl"
and "secondaryUrl", it would be best to make them all consistent to
prevent any bug that could happen in the future.

Change-Id: I56e6a1d2c7695204b35e767679a27ee22b3fe4bc
2024-08-17 07:09:41 +09:00
jenkins-bot f38a43f58d Merge "Remove obsolete PHPDoc copies from fully typed constructors" 2024-08-16 19:09:22 +00:00
Bartosz Dziewoński 22b05a1e3f Replace gettype() with get_debug_type() in exception messages etc.
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.

Also remove uses of get_class() where the new method already provides
the same information.

For reference:
https://www.php.net/manual/en/function.get-debug-type.php
https://www.php.net/manual/en/function.gettype.php

Change-Id: I54c2bf287b185e2526b0a8556166fd62182b2235
2024-08-16 16:53:47 +00:00
thiemowmde 2a4f186400 Remove obsolete PHPDoc copies from fully typed constructors
It's all in the code now. These comments don't add anything any
more.

Change-Id: I66a3723c4fe9ccce989f5b533390d5ce928dc195
2024-08-11 18:05:01 +02:00
Umherirrender 9380504852 Replace deprecated LinksUpdate::getAddedLinks
The current code uses deprecated TitleLinksTable::getTitleArray and that
is also using Title::newFromPageReference to get Title objects,
so performance issues or more memory usage are not expected.

Change-Id: I25d047ceb707837009e0a703693ebc2f49fc0ba9
2024-07-30 01:50:17 +02:00
jenkins-bot 2966c87804 Merge "Use namespaced MessageSpecifier" 2024-07-28 21:29:59 +00:00
Bartosz Dziewoński 88a5a4cbc6 Use namespaced MessageSpecifier
Depends-On: I9ff4ff7beb098b60c92f564591937c7d789c6684
Change-Id: I44aa53990bc11d24afa02399dc6dfec7d0c10b9a
2024-07-28 21:59:25 +02:00
Umherirrender 552f362cd5 Use expression builder instead of raw sql
Change-Id: I6516951fc855dc32e864a3f21187b0a73daba7c8
2024-07-21 22:52:17 +02:00
thiemowmde 7845b5fab1 Fix mistake in gender support for user group changes
This was a mistake in I53c0283, sorry. There are two users involved:
The "agent" is the user (typically an administrator) that made the
user group change, while the "viewing user" is the user for which the
user group was changed. When the "agent" moves the "viewing user"
into a new user group, the "viewing user" is the one that's now
a member of that group. They are what dictates the gender for the
"group-…-member" message.

Is this mistake bad enough for a backport?

Bug: T368249
Change-Id: I4916de2fb171873b625e51ee8823811e0296d323
2024-07-05 20:18:56 +02:00
thiemowmde eaa1fea890 Fix incomplete gender support for user group changes
This affects primarily the message
"notification-header-user-rights-add-only" which is very priminently
seen by every new editor that made their first few edits and gets
promoted to the next user group a few days later. Turns out the code
was just incomplete. All the information about the user and their
gender is already there, it was just not forwarded correctly.

Notice there are two messages:
* "group-…" messages don't have gender support. This is the (ideally)
  gender neutral name of the group. Meant to be used as e.g. section
  heading for a list of users.
* "group-…-member" is the same with gender support. To be used in all
  contexts that are about a single, specific user with known gender.
  Which is exactly what's happening here.

Turns out we can even use a neat convenience function from the
Language class that does exactly what we need.

I can't tell why but the array_values is apparently critical.
Originally added via I49b5fe5. It can't hurt so I keep it.

Bug: T368249
Change-Id: I53c028375d77c93f399538fd38aa8f8af30934b0
2024-06-28 11:49:10 +02:00
thiemowmde c246f71eb6 Remove unused param from notification-bundle-header-page-linked
The duplicated parameter $6 is unused since 2016, see Iabeaae7.
Nothing is left that uses the parameter. I also checked for local
on-wiki overrides via GlobalSearch.

Bug: T368249
Change-Id: I8a5975347756f2fd5f5e065112ddc38d829e89ed
2024-06-26 13:20:05 +00:00
Wandji69 231ce97335 Use ObjectCacheFactory instead of ObjectCache method
Bug: T363770
Change-Id: I685ee42b11fab3bb56810af65a1334573d16da8a
2024-06-26 10:19:13 +01:00
thiemowmde b983ce7581 Fix copy-paste mistake in message documentation
This is a copy-paste mistake from the message directly below.
Happened in Ibe0092a not long ago.

Also add some comments to make it easier to find the places where
seemingly unused messages end being used.

Bug: T368249
Change-Id: I709c0f14978daad8c98f1f8edf52ef28029c6d40
2024-06-24 09:07:19 +00:00
Umherirrender a51c944567 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I3d7a1ffe167b69d3f4ce51d0c248c758e1cdd70c
2024-06-12 20:31:47 +02:00
jenkins-bot 7954f54451 Merge "More specific type hints and type declarations" 2024-06-07 03:06:57 +00:00
jenkins-bot 63736536f5 Merge "hooks: remove use of IBufferingStatsdDataFactory" 2024-05-27 11:49:47 +00:00
jenkins-bot a538b2025a Merge "hooks: add StatsFactory support" 2024-05-27 11:44:28 +00:00
thiemowmde 7e3d73c11b More specific type hints and type declarations
Most notably:
* Use the much more narrow UserIdentity interface where possible.
* Make array type hints in PHPDocs as specific as possible.

Change-Id: Id189da4028b7874909277881dcf6539169dd13b6
2024-05-16 10:32:19 +02:00
Cole White b29a6ae0e5 hooks: remove use of IBufferingStatsdDataFactory
Bug: T363590
Change-Id: Ib35ec605bf1ce3c0c026513f1f4636f991d36ea3
2024-05-15 02:31:08 +00:00
Wandji69 37cac555b8 Use ObjectCacheFactory instead of deprecated ObjectCache method
Bug: T363770
Change-Id: Ib1aaa8fc3e6099bfaf33ec45645f6774addec711
2024-05-14 19:30:17 +00:00
Umherirrender 1c257ea377 Revert "Suppress phan errors caused by UserMerge undeploy"
This reverts commit e8cbb4d662.

Reason for revert: phan dependencies are restored

Depends-On: I0d07c9412bbb63c947255587a88020637e70b80a
Change-Id: Ib6c1709483e4d8518510c4477bf15699cafc1313
2024-05-14 08:40:50 +00:00
Amir Sarabadani e8cbb4d662 Suppress phan errors caused by UserMerge undeploy
Bug: T364610
Change-Id: If52dfcb083995b08bb34b59d2c9e78bf04ca0199
2024-05-10 15:57:25 +00:00
Siddharth VP e27f4937ff Add API module for sending notifications
Allows users to send notifications to themselves (T306211). For sending
notifications to others, a new permission is created (echo-create),
assigned only to bots by default. For now, only one user can be notified
in one API request.

If the email flag is set in the API params, the notification is also
sent as an email, provided the user hasn't disabled email notifications
for the "api-triggered" category.

This feature is behind a feature flag. Set $wgEchoEnableApiEvents = true
to use.

Adapted from If0267a38be7d454e3d284d30f93c93a828288dd7.
Co-authored-by: TheresNoTime <starling-ctr@wikimedia.org>

Bug: T58362
Bug: T306211
Change-Id: I94642bff5dcb075cb9db862206d59c19edad9fd1
2024-05-04 17:43:39 +03:00
Cole White 706422006d hooks: add StatsFactory support
Bug: T363590
Change-Id: I88579655b72fb982f50f4304997bbba197f89f47
2024-05-04 07:41:54 +00:00
Umherirrender 96ef4cfd2d Migrate to IReadableDatabase::newSelectQueryBuilder
Also use expression builder to avoid raw sql

Bug: T312333
Change-Id: I6ce22de6637fccca8cf86a405bc023f268ff693b
2024-04-28 01:05:10 +02:00
jenkins-bot e8541912d5 Merge "Make use of native str_starts_with() where possible" 2024-04-20 22:11:37 +00:00
thiemowmde fa23779a17 Stop using the Xml class in this codebase
Many of the Xml::… methods are deprecated. This code here is not
generating XML anyway, but HTML.

Bug: T341775
Change-Id: I69edf4606bc5cb429d48c8188c691b44575e2d93
2024-04-19 20:41:40 +02:00
thiemowmde d498e09e49 Make use of native str_starts_with() where possible
Change-Id: If95d0c801e397ca00b0c0d792c28f972c642b377
2024-04-19 20:36:31 +02:00
Umherirrender 2feece8bad IReadableDatabase::select cannot return false
Remove check for false from IDatabase::select as this is not possible
A DBQueryError is thrown (documented since efda8cd3 / I056b7148)

Change-Id: I465a9158aa6430e7ff8a5a83fe55c5944315aa40
2024-04-18 22:53:15 +02:00
jenkins-bot 71ec391deb Merge "Migrate to IDatabase::newInsertQueryBuilder/newUpdateQueryBuilder" 2024-04-14 18:00:20 +00:00
Umherirrender aa41e1e292 Migrate to IDatabase::newInsertQueryBuilder/newUpdateQueryBuilder
UpdateQueryBuilder does not return a value,
removed the return value from the functions as well,
deprecated since 1.33

Change-Id: I3b934a5e6d5a53c07ec5233da00d9f53ba7bae92
2024-04-13 22:51:32 +02:00
Umherirrender d2eb46e7b9 Migrate to IDatabase::newDeleteQueryBuilder
Change-Id: I516c179df464be68352809873dbff44dc3c642f1
2024-04-12 22:45:45 +02:00
Fomafix 2d9ffb7301 Inject services into NotificationDeleteJob
Change-Id: I0988e2d486eaf43cb999d38c0d2a0c81a7930cfd
2024-04-04 14:56:38 +00:00
Umherirrender b8e54d8e2c Migrate to IDatabase::newInsertQueryBuilder for upsert
Change-Id: I532b206b6c1d652369d4f986d0f5b91958a1ef47
2024-04-02 16:38:05 +02:00
Umherirrender 297ed70cb2 Replace isset() with null check in DiscussionParser
Found usage of isset() on expression self::$diffParser that appears to
be always set. isset() should only be used to suppress errors. Check
whether the expression is null instead.
See https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset

Change-Id: Iaaad420ad05b8352f8a7f162c746591749c8b3e9
2024-04-01 13:37:27 +02:00
jenkins-bot fda5f7daa6 Merge "Inject service RevisionStore into RevisionLocalCache" 2024-03-18 09:06:16 +00:00
jenkins-bot 817dd42561 Merge "Inject service LinkBatchFactory into ApiEchoMute" 2024-03-17 22:39:16 +00:00
Fomafix 5595193eb3 Inject services into TitleLocalCache
Change-Id: Ib1259484436591dd30b29651ccca474c0ce16d13
2024-03-17 21:22:00 +00:00
Fomafix 98feb3f3fd Inject service RevisionStore into RevisionLocalCache
Change-Id: I4945d582138af4500f8c6929ca0c97d05f10377e
2024-03-17 20:15:51 +00:00
Fomafix 73bd6e8ef1 Inject service LinkBatchFactory into ApiEchoMute
Change-Id: I98c1d2f6b1aa04eb64cef299a6aca475658bdd74
2024-03-17 19:13:44 +00:00
Gergő Tisza c6accbeff0 Style fixes to ApiEchoMute
Change-Id: Ic70095d44282b19fb10239c6e579acbbeccae5bd
2024-03-15 00:36:43 +00:00
Martin Urbanec 9daf86b662 Stop inserting new user_properties rows on signup
This starts using conditional user defaults, which were
already deployed to WMF production config.

Bug: T353225
Change-Id: I93c6efc40d1ef6c46d8711fc5a4161e5d8f683e3
2024-02-26 15:09:02 +00:00
jenkins-bot b0d1a454fe Merge "build: Updating dependencies" 2024-02-14 17:15:45 +00:00