Commit graph

1620 commits

Author SHA1 Message Date
jenkins-bot b58122fa3e Merge "special: Check login permissions before calling execute method" 2024-10-28 02:55:18 +00:00
Ammarpad 4303ab5f71 special: Check login permissions before calling execute method
Calling the parent method first means the form has to be built (as
well as various other things) and then it cannot be shown because
of permission and the user is redirected.

This also lead to confusing behavior where some code paths are
reached even though the user cannot actually access the page.

Change-Id: If354d98f9e51acef38cac114a7704d28c148017b
2024-10-27 10:03:09 +01:00
jenkins-bot 570d326543 Merge "fix ::getTruncatedSectionTitle() return type" 2024-10-26 22:19:15 +00:00
Andre Klapper 4da4dad97b 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-10-26 15:05:13 +02:00
Umherirrender 2edd88a166 Use type-declaration on api module constructor
Parent class constructor gets type-declaration in 1145328459
Remove simple doc-blocks without further information

Change-Id: I0ab283cd0510d8e85e93752a5ee7d65320a4ec2b
2024-10-25 19:14:31 +02:00
jenkins-bot 052dc0a3ef Merge "Fix for Watchlist Notifications for deleted pages created in 1.35" 2024-10-25 00:13:25 +00:00
Ammarpad 0a677f4675 fix ::getTruncatedSectionTitle() return type
This method can return false if getParsedSectionTitle() returns false

Both Language::embedBidi and Language::truncateForVisual return
non-string primitives unchanged if they're passed to them as first
argument.

Ideally the Language methods arguments should be string-typed but
I am not sure how easy that change would be now, so better to
document the possibility here.

Change-Id: I7e2856862d6508ecd1aa57ad99b92942bc4d7bed
2024-10-24 22:46:00 +00:00
Reedy a76cc44a60 SpecialNotificationsMarkRead: Don't pass null to explode()
Bug: T377920
Change-Id: I426c76dbf2e8da4563e93fefe6bd628faa0e13b7
2024-10-23 15:16:04 +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
Pavel Astakhov 4c35cecea0 Fix for Watchlist Notifications for deleted pages created in 1.35
Bug: T286192
Change-Id: I9d4ab915ca33a3d52018470f1147eb77f5590c86
2024-04-16 17:02:26 +00: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