Commit graph

1311 commits

Author SHA1 Message Date
TChin 113230aaed Replace deprecated UserSaveOptions hook
Bug: T287472
Change-Id: I170cd7f5676459f83e7b1abadf5485486b8caaab
2021-07-27 15:24:51 -04:00
jenkins-bot 9e9303221e Merge "SpecialDisplayNotificationsConfiguration: Fix default values of core prefs" 2021-07-27 18:32:19 +00:00
jenkins-bot 0364d96af3 Merge "SpecialDisplayNotificationsConfiguration: Use OOUI checkboxes" 2021-07-27 18:32:18 +00:00
Bartosz Dziewoński 0341634e45 SpecialDisplayNotificationsConfiguration: Fix default values of core prefs
Some of Echo's subscription user preferences are mapped to existing
user preferences defined in core MediaWiki. However, this special page
was checking the Echo preference names, returning incorrect values.

This affected the edit-user-talk preference and watchlist preferences
(not available with the default configuration).

Change-Id: I2de7553f82434505c000c30a71b9f90c4490482b
2021-07-27 19:53:58 +02:00
Bartosz Dziewoński b826dd263c SpecialDisplayNotificationsConfiguration: Use OOUI checkboxes
On some systems, when they are disabled, checked and unchecked
checkboxes are not that easy to distinguish. They're really bad
for me on Windows (apparently a bit less bad on macOS).
https://phabricator.wikimedia.org/F34567120

OOUI checkboxes are clearer (since they're bigger and the
check icon has higher contrast against the background).
https://phabricator.wikimedia.org/F34567121

Change-Id: I124c7e1874d50d5f3883ffcc5264da46ae012e0a
2021-07-27 19:33:30 +02:00
DannyS712 4cc8233ee5 DiscussionParser: fetch UserNameUtils service outside of loop
Change-Id: I6c523dcc2ca1e06136f2f5ad18c0ac371c7f9494
2021-07-26 09:40:49 +00:00
DannyS712 f13dd018c7 Enable and fix ReturnTypeDeclaration sniff
Libup decided to disable the sniff, fix the issues instead

Change-Id: Ibac1c3f32af19edff3f428928efe578d97061b07
2021-07-24 04:36:30 +00:00
libraryupgrader 17a644263a build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs are failing and were disabled:
  * PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeReturnType

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: Id866782d39ac02a329bd79539f2d52392fffd296
2021-07-24 01:48:06 +00:00
jdlrobson b4ec1eda88 Fix display of user messages orange bar
The icon in Vector is copied across when Vector is loaded before
Echo in LocalSettings.php

Change-Id: Ida8c78e5c723f9628928f0293f43b2d67616888f
2021-07-22 13:21:53 -07:00
jenkins-bot e8430bd44a Merge "Update vector badge styles" 2021-07-22 17:59:38 +00:00
bwang b0aaa2e4ec Update vector badge styles
- Override echo icon styles for modern vector
- Reverts https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Echo/+/704862

Bug: T285259
Change-Id: Id71d3e248dc6d0ee24278e0ecfbcf8691e1da24b
2021-07-22 11:53:36 -05:00
Petr Pchelko a10b0b07c8 Use CentralIdLookupFactory and pass UserIdentity
Change-Id: I44144df7cf244eb867c1b261c10cc29b020f8409
2021-07-21 19:23:42 -07:00
Matěj Suchánek 3f05f8a71b Drop unused property and inject a service to SpecialDisplayNotificationsConfiguration
Change-Id: I0f238b863638245eef381e540da7d610d01bd25b
2021-07-17 10:40:45 +00:00
jenkins-bot a6dbadb006 Merge "Avoid using User::setOption()" 2021-07-17 10:29:45 +00:00
ZabeMath 3befbe0a69 Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: I001301fb95635c421a0bbb921fd909c5312dc896
2021-07-17 09:52:53 +00:00
bwang fbde7bd61b Add icon property to echo link data for modern Vector
Bug: T285259
Change-Id: I995f877a6e8574a519aedece31e7889b9735366a
2021-07-16 15:05:29 +00:00
DannyS712 3269afae8e Remove use of global $wgUser
This partially reverts commit 83a181ce9c
and fully reverts 82896eff62

To avoid regressing to the errors from T139665, check if the user
retrieved from RequestContext::getMain()->getUser() is safe to load
instead of $wgUser, still in addition to the other checks that
EchoForeignWikiRequest::$user is safe to load.

Bug: T243732
Change-Id: I22c4918fc7e8b3d1364a95de3958c055059971b8
2021-07-14 04:57:34 +00:00
jenkins-bot fa8331294b Merge "Hardcode talk alert id to be pt-talk-alert" 2021-07-13 19:42:47 +00:00
bwang 2bf4047410 Hardcode talk alert id to be pt-talk-alert
Bug: T285442
Change-Id: I3b46a494682b3b5055f525c0c1219a1710655ce5
2021-07-13 13:58:06 -05:00
jenkins-bot bfcbfff6f6 Merge "Drop DB patches from pre MW 1.26" 2021-07-13 13:52:27 +00:00
jenkins-bot 7cb32579c7 Merge "Simplify code for detecting rollbacks" 2021-07-12 23:04:20 +00:00
jenkins-bot 98d7428837 Merge "Avoid using ContentHandler::getContentText()" 2021-07-12 14:22:05 +00:00
jenkins-bot 31d115e9f3 Merge "Remove probably outdated error suppression" 2021-06-29 17:49:35 +00:00
Matěj Suchánek 4b4954ac40 Remove probably outdated error suppression
https://bugs.php.net/bug.php?id=50688 was closed as fixed
in 2017 when PHP 7.0 was only supported upstream.
We already require PHP 7.2.

Change-Id: Ie9801e38915da634e31c91ebdcb61226e0ae5712
2021-06-29 17:29:23 +02:00
DannyS712 0099c45e54 AttributeManager: accept UserIdentity objects
Inject a UserOptionsLookup to replace deprecated
User::getOption()

Change-Id: I177f6d3486f987073e5d745077f0abfe9ae85aca
2021-06-29 06:41:47 +00:00
DannyS712 66a290500c EventLogging: accept UserIdentity objects
Replace User::getEditCount with UserEditTracker service

Change-Id: Idcf98dc6b1e88f9301b731b1d8296f613464a364
2021-06-29 06:12:59 +00:00
DannyS712 2e1757eaaf NotificationMapper: accept UserIdentity objects
No need for a full User, only the user's id is retrieved

Change-Id: Ibf4005c83d66d846b7e1ab711cd135c9ae08964a
2021-06-29 05:53:41 +00:00
Reedy 5d4a012d48 Drop DB patches from pre MW 1.26
Change-Id: I6693239455a2696b7bb77841041204b75a3c99fb
2021-06-27 23:16:03 +00:00
Reedy 532faf27f5 Reorganise MySQL/SQLite patches
SQL files that are MySQL/SQLite specific have been moved to subfolders

Change-Id: Ib677815f2fb6a4e3aa0236a31160efaf761ad4ef
2021-06-26 16:24:14 +00:00
Jan Drewniak 6ccbea0d5a Set .mw-echo-alert class on link instead of list-item
Update to 7880cc18, restores ".mw-echo-alert" class on "class" property
instead of on "link-class" property.

Bug: T284496
Change-Id: I11a04fa5a7e9d0b34e62733ee537a43549d13477
2021-06-08 13:29:59 +02:00
Nicholas Ray 2583f803c3 Add talk notification instead of transforming the talk link
Note: This change would potentially affect all skins including modern
and legacy Vector and others.

The status quo when a talk notification is present is to transform the
talk link into an orange notification message. One option is to leave
the talk link and **add** a notification instead of transforming it.

This will result in two elements #pt-mytalk and #pt-talk-alert
This will interfere with styles targeting #pt-mytalk .mw-echo-alert
This impacts user styles but not anything in production.

Bug: T283811
Change-Id: I3e4be1381f9a2e9986b94b3b13df5ed64d09a59d
2021-06-04 09:33:50 -07:00
jenkins-bot 76f525b69f Merge "SpecialNotifications: Load mark-as-read icon in no-JS mode" 2021-06-03 17:10:37 +00:00
jdlrobson 4c58a85bb1 Echo hook needs to consider other hook modifications
Follow up to 7880cc1

Bug: T274428
Change-Id: Ia4520a3df28027d43ecdeb217b108669e7cb6795
2021-06-02 17:25:00 +00:00
Bartosz Dziewoński ab6a37f4e1 SpecialNotifications: Load mark-as-read icon in no-JS mode
Follow-up to 34e3d5feba.

Change-Id: I780baad06e16b29a8a1b033af60f14c33368119b
2021-06-01 23:02:59 +02:00
Nicholas Ray 7880cc1895 Make talk page notification use link-class, id and don't set class
Before this commit, setting:

```
$wgVectorConsolidateUserLinks = [
  'logged_in' => true
];
```

would result in an orange talk notification that had missing or
incorrect attributes (`#ca-mytalk` instead of `#pt-mytalk` and missing
the `title` and `accesskey` attributes) when visiting modern Vector
with a talk notification visible. The notification's html looked like:

```
<li id="ca-mytalk" class="mw-echo-alert">
  <a href="/wiki/User_talk:Newuser5">You have a new Talk page message</a>
</li>
```

The `pt-mytalk` id is important for echo to remove the notification [1].
The title and accesskey are important for accessibility reasons.

This commit corrects that by setting a `link-class`, setting an explicit
`id`, and NOT setting a `class` key. This results in html that is
correct in both modern and legacy Vector:

```
<li id="pt-mytalk">
  <a href="/wiki/User_talk:Newuser5" class="mw-echo-alert" title="Your talk page [ctrl-option-n]" accesskey="n">You have a new Talk page message</a>
</li>
```

[1] 67bf58a489/modules/ext.echo.init.js (L172)

Bug: T274428
Change-Id: I5afc74992ad3153ac32df65ccf5fd03b469f05fb
2021-05-27 19:22:10 -06:00
Nicholas Ray 3a351cfb4f Move talk page notification data from 'user-menu' to 'notifications'
**Note**: This change will affect the order of the yellow talk page
message notification on legacy Vector/other skins by moving it from
after the `#pt-notifications-notice` element to before the
`#pt-notifications-alert` element. This was done because the
notification is related to the list of messages that appear when the
bell icon is clicked so having it in close proximity to that icon is
hopefully more intuitive than having it next to the unrelated inbox
icon. [1]

Per T274428, we need this notification to be inside the `notifications`
array instead of inside the `user-menu` array.

Additionally:

* Per T274428, update the notifications message copy to "You have a new
Talk page message"

* Remove the `onPersonalUrls` hook method inside EchoHooks,
unregister its use as a hook in extension.json, and update its
references in Echo.

[1] T274428#7113896

Bug: T274428
Change-Id: I5ae0ec089bcf0eec1ec7ac13f60e811f54e1d8e1
2021-05-25 18:24:29 -06:00
Bartosz Dziewoński 3762c3d4d8 Simplify code for detecting rollbacks
Thanks to the changes from T254074, the EditResult object passed to
the 'PageSaveComplete' hook now knows whether the edit being saved
is a rollback. We don't need to pass this information from the
'RollbackComplete' hook via globals.

Bug: T277649
Change-Id: Ieef7941e4665204b1a9b2356a58216626ed1f54b
2021-05-25 20:32:36 +02:00
jenkins-bot 6ed6337aed Merge "Replace RecentChange::getPerformer with RecentChange::getPerformerIdentity" 2021-05-24 15:27:56 +00:00
Vadim Kovalenko 3e65888791 Replace RecentChange::getPerformer with RecentChange::getPerformerIdentity
Refactor $actor as UserIdentity
Refactor Event::getAgent() to return UserIdentity

Bug: T276412
Change-Id: Ieb0dbacd2dcab7700b83fb090587b4957c8128c9
2021-05-24 18:01:04 +03:00
Alexander Vorwerk bba113d92e Avoid using ContentHandler::getContentText()
ContentHandler::getContentText() is deprecated and should be
replaced with Content::getText() for TextContent instances.

Change-Id: Ia92c5a41954b1d21deb39dcafabbdff60a414f55
2021-05-17 23:44:00 +02:00
Umherirrender 37c602c532 Replace uses of DB_MASTER with DB_PRIMARY
Change-Id: I20abc845a3c74173ec4a111874c20cdeb1abd1d9
2021-05-13 02:04:54 +02:00
Umherirrender e80884549c Use ::class for class name
Change-Id: I43364430206207b49d702c842cdc8a74ca0c4102
2021-05-08 00:03:13 +02:00
James D. Forrester 4dd2a651e1 phpcs: Auto-fix MediaWiki.Usage.StaticClosure.StaticClosure
Change-Id: I6a02902ffaa8a9b497d60b573a0b8e3dbc207ee5
2021-05-04 09:06:42 -07:00
libraryupgrader b3f948c59c build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I4b2fb7f46b6c0a5c33a6ad25f085de8ae13eb084
2021-05-04 09:05:15 -07:00
jenkins-bot bd8ad42a30 Merge "Remove redundant check" 2021-04-30 08:10:10 +00:00
jenkins-bot 20420275fa Merge "EchoEventMapper: use DISTINCT instead of GROUP BY" 2021-04-30 08:09:22 +00:00
Tim Starling e1d2001040 EchoEventMapper: use DISTINCT instead of GROUP BY
I think the problem the GROUP BY was trying to solve was the potential
for there to be multiple rows with the same (etp_page,etp_event) pair.
There's no unique index to prevent that, and it would cause the event to
be duplicated in the result set. DISTINCT fixes that without generating
an error with sql_mode='ONLY_FULL_GROUP_BY'.

Per https://dev.mysql.com/doc/refman/8.0/en/distinct-optimization.html
DISTINCT is effectively shorthand for a GROUP BY with all the fields.

Bug: T281329
Change-Id: I6a0d578d729c33241a5c5fbd3f4e83f0e5fab83f
2021-04-30 09:40:25 +02:00
Cindy Cicalese ccfb1dbbda Replace usage of deprecated User watchlist methods
Bug: T281187
Change-Id: Id380a5441e30041b6fb79f6ad1fc0506b6a770f9
2021-04-28 17:17:26 -04:00
jenkins-bot df47c71874 Merge "EchoHooks: Skip onOutputPageCheckLastModified on action=raw" 2021-04-03 10:51:55 +00:00
Timo Tijhof cc50ae633d EchoHooks: Skip onOutputPageCheckLastModified on action=raw
Bug: T279213
Change-Id: I9d3bf664f86c6dba5cc526a17bfab10303e0267d
2021-04-02 23:39:31 +01:00