Commit graph

1282 commits

Author SHA1 Message Date
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
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
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
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
Umherirrender dbce3cc026 build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Fixed a suppressed sniff issue

Bug: T278594
Change-Id: I5a3ae09cd0dd6a27699557e472d2ff74ef03a731
2021-03-27 01:04:58 +01:00
DannyS712 acfa4e2f76 TitleFactory is not @newable, retrieve from MediaWikiServices
For creation of MultiTitleFilter

Change-Id: Ic527359d31fc0116a23c3173ba0f66f4bdfe3067
2021-03-21 23:54:55 +00:00
jenkins-bot 9b6b5ecbe0 Merge "Introduce 'EchoGetEventsForRevision' hook" 2021-03-19 18:38:32 +00:00
Ed Sanders 756b02b566 Introduce 'EchoGetEventsForRevision' hook
Collect event data and allow modification by a hook.

This allows extensions to look at the events generated so far,
add more events, or remove events.

Bug: T276990
Change-Id: I60818d57552946857077dee93b0adb036621b791
2021-03-17 21:59:13 +00:00
Bartosz Dziewoński 43747e5b0b Remove redundant check
$wgEchoNotifications is checked inside EchoEvent::create(). Similar
code (e.g. onRollbackComplete() in this file) does not check it.

Change-Id: I2be05ae182c3fd5d90b87e9579f8c2aa6b79c655
2021-03-17 12:50:45 +01:00
mech 2d8085bd15
Unset user-to-user email option when user emails are disabled
When one of the $wgEnableEmail and $wgEnableUserEmail variables is
false, "Email from other user" option should not be shown in
preferences.

Bug: T266087
Change-Id: I38e439b778d2679967776757d8e0d3b63519612e
2021-03-08 23:20:07 +01:00
vladshapik 92d41cac00 Avoid using User::isBlocked
Remove using of User:isBlocked since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T276371
Change-Id: Ibcb9071ce2df2733ee5bd87e077b3c0d034d1212
2021-03-03 21:39:10 +02:00
jenkins-bot 150fdba4cf Merge "Avoid using User ::getCanonicalName" 2021-03-01 20:16:02 +00:00
vladshapik e0d64d00d0 Avoid using User ::getCanonicalName
Remove using of User::getCanonicalName since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T275030
Change-Id: Id708800bc709de175bc7c6acc422368a734b00f1
2021-03-01 19:50:14 +00:00
Jeena Huneidi 008ad5afe1 Remove deprecated User method getGroups
Replaces the deprecated user method getGroups with
UserGroupManager->getUserGroups.

Bug: T275148
Change-Id: Ie6215886c911382008b667e8e5b3298facfcd6a2
2021-02-26 21:47:58 -08:00
jenkins-bot ac8d21d2a1 Merge "Make AttributeManager a service" 2021-02-26 23:45:26 +00:00
Jeena Huneidi 596729d852 Make AttributeManager a service
Adds AttributeManager to EchoServices so that dependencies of
AttributeManager can be injected.

Bug: T275148
Change-Id: I4fa5084d72914d16b6d218e7dd3521f5a1919b80
2021-02-26 12:58:23 -08:00
vladshapik 107c0dfccd Avoid using User::IsIP
Remove using of User::isIP since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T275602
Change-Id: Ic1749cbad92bfe0eeae40736403fd5ceb6d504e8
2021-02-24 15:31:50 +02:00
Ed Sanders c5aba7e62c UserLocator::locateUsersWatchingTitle: Avoid confusing re-use of variable name
Change-Id: I5826fe7c4ecd15907dc63c5afd6e777637d32c8a
2021-02-23 16:36:17 +00:00
Kosta Harlan 0805daf1c2 Echo::create: Convert UserIdentityValue to plain User
Bug: T275161
Change-Id: I28c8494ee557a67ea54dcab2ea9955561e8c2472
2021-02-18 20:31:35 -08:00
vladshapik aac1986c3b Clean up Title deprecated methods
Replace hard deprecated getPreviousRevisionID method with RevisionLookup::getPreviousRevision method

Bug: T274151
Change-Id: Ia6ec1a4765ba5849b53919a6e9d73df7e839f6ed
2021-02-18 14:45:20 +02:00
Kosta Harlan 294ed3c2cb ForeignWikiRequest: Guard against bad response
See also I4dde4e3bb4ff2ea8b7669bb18b2689410e5e7713

Bug: T274408
Change-Id: I3ab7d0a4b58a150fe940bc8441b5fb127142ad9f
2021-02-17 10:11:10 +01:00
Umherirrender ddf5b4bd24 Remove wrong return null from function documentation
Change-Id: I1a702bbdd4378a35216641ec73fbe318f02bde69
2021-02-03 21:59:07 +01:00
Martin Urbanec 36c65d8fa8 Log ApiEchoUnreadNotificationPages bad responses
ApiEchoUnreadNotificationPages::getUnreadNotificationPagesFromForeign we
sometime erroneous responses from the foreign wiki. We silently ignore
them since d8a4b6ba9, this add logging of the response payload.

Bug: T273479
Signed-off-by: Thiemo Kreuz <thiemo.kreuz@wikimedia.de>
Change-Id: I4dde4e3bb4ff2ea8b7669bb18b2689410e5e7713
2021-02-03 10:47:32 +01:00
Thiemo Kreuz d8a4b6ba91 Add missing isset() check to ApiEchoUnreadNotificationPages
…::getUnreadNotificationPagesFromForeign().

I'm not 100% sure if this fixes the code in a way it is
supposed to work. However, I see that getFromForeign() is
called 3 times in existing code, and 2 of these places
already do an isset() check. It looks like it was just
forgotten here.

Even if there is another issue to fix here, this patch:
a) silences the error, and
b) gives us more useful debug output.

Bug: T273479
Change-Id: I257620f646196c0554b9d86c849a02f5a8b9519c
2021-02-03 06:42:26 +00:00
Ammarpad 5b032f5589 Echo: Remove redundant cast
User::getId() is typehinted to return int and so this cast is causing
Phan failure.

Note the method is deprecated but this patch is not meant to fix that.

Change-Id: I3b7ad419d7c28c3ad7144b8005f2fa387af58b0d
2021-02-03 07:39:38 +01:00
Thiemo Kreuz 0f954929a7 Remove comments that literally repeat the code
This also fixes a remaining `var` that should be `private`.

Change-Id: Ifa37a097a9d60bd22a16bc626d4b4271b8df2da7
2021-01-29 13:55:41 +01:00
mainframe98 d426e6fb54 Provide notifications icons through content navigation
Ia1451e3e802441162eecfc5b7f6a7ba2ae72f377 introduced
the notifications content navigation, which allows skins
to choose where they want notifications to be positioned,
rather than requiring them to manually extract them from
the personal tools.

Bug: T266613
Depends-On: Ia1451e3e802441162eecfc5b7f6a7ba2ae72f377
Change-Id: I7badfd9bf9257b2537596e9f2e93248f52e4bd82
2021-01-27 17:36:24 +01:00
jenkins-bot 6042d6e389 Merge "Prefer UserIdentity::isRegistered over isAnon" 2020-12-23 08:25:04 +00:00
Thiemo Kreuz c9797db768 Prefer UserIdentity::isRegistered over isAnon
isRegistered is part of the slick UserIdentity interface, i.e.
it's the more "canonical" form. This change makes it a bit
easier to move away from using the huge (4000+ LOC) User class
everywhere, in favor of the UserIdentity interface, where
possible.

This patch is meant as a small step towards this goal. I tried
to replace some usages of User type hints already, but prefer
to go in small, incremental steps.

Change-Id: I039c7a18672dfb6ea9507752bce9ea754babd690
2020-12-23 07:15:30 +00:00
James D. Forrester eec3ac85bb Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: Ieb3f78a7e5f71fc28f31c01d981d246cdd895581
2020-12-17 18:32:42 -08:00
Umherirrender d7556b1d96 Add missing @var and improve documentation
Change-Id: I729d5ff5afd4d45022fa0a4e42d060d35543b567
2020-12-17 20:55:49 +01:00
Umherirrender 1a922d4443 Remove unused SpecialNotificationsMarkRead::$eventId
Change-Id: I37b647fb1bb35b13d72c56619db6d4007db61f82
2020-12-17 19:05:58 +01:00
libraryupgrader b391178348 build: Updating mediawiki/mediawiki-phan-config to 0.10.5
Change-Id: I8892cea01993f0ae51eebabaaf40685889124943
2020-12-10 18:20:15 +00:00