Commit graph

1276 commits

Author SHA1 Message Date
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
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
jenkins-bot 2f15134088 Merge "push: die with error if providertokens param is empty" 2020-11-10 18:24:46 +00:00
mbsantos 86d45a66ca push: die with error if providertokens param is empty
Bug: T267263
Change-Id: Icf98189726602dd8e43e1f9daf19e3f73efb91b0
2020-11-10 16:50:37 +01:00
jenkins-bot 6135c62518 Merge "Avoid enqueueing delayed jobs if not supported." 2020-11-02 16:52:31 +00:00
jgiannelos 4f4786c62c Avoid enqueueing delayed jobs if not supported.
Change-Id: Ibb065f77a67bf47daafb6caaf8a338d0bcd479e7
2020-11-02 16:06:09 +01:00
shubham656 90887d290c Modify EchoHooks.php to make hook not pass the entire special page
Bug: T257183
Depends-on: I7af57455d412dc5e93617ca0b3d6e7aac8ef500f
Change-Id: I4ec64e5d94a788d0cc1ed3c6e71096e9c830cbd1
2020-11-02 13:46:34 +05:30
jdlrobson 2f020163ee Restore old Echo styling through several reverts
These dont work. Timeless provides its own skinStyles for this module:
* Revert "Timeless skinStyles should be additive not replace"
This reverts commit 98d0d296a8.
* Revert "Use skinStyles for deciding where the text-indent should apply"
This reverts commit 8adab78547.

A new implementation in Vector means these are redundant:
*  Revert "Item label can now use overflow hidden"
This reverts commit b5dd7baa08.
* Revert "Drop text indent in modern Vector"
This reverts commit 150fc7a16c.

Bug: T264339
Depends-On: I2afc12504d7184583fa8331479125474c68017dc
Change-Id: Ifd0dd5a0479588664b772fb839dbbcd8d7c47320
2020-10-29 16:59:45 +00:00