Commit graph

1346 commits

Author SHA1 Message Date
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
Bartosz Dziewoński 7f993f570d Link to the section (if known) from the orange banner
If there's exactly one new user talk message, then link directly to it
from the orange banner.

I'm using EchoEventPresentationModel to get the link target, instead
of some more direct way, because this approach allows us to override
the link in DiscussionTools. Together with the changes proposed in
T281590, this would allow linking directly to individual messages (and
highlighting them), rather than just the section.

Bug: T58475
Change-Id: I1fd0e22f4ee0f0dfacaf420d3fd890dce0820cbd
2021-06-07 21:48:48 +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
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
libraryupgrader f5ff16571e build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Commenting.PropertyDocumentation.MissingVar
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage

Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).

Change-Id: I46e3dacb3da1266ff52d614003ad911feeb7504e
2020-10-29 14:24:24 +00:00
jenkins-bot cf0e87d18e Merge "Fix DiscussionParser failing in certain languages" 2020-10-29 00:16:32 +00:00
jenkins-bot ba63c30715 Merge "Implement delayed echo notifications" 2020-10-28 17:52:37 +00:00
jgiannelos c97b8e6851 Implement delayed echo notifications
* EchoEvent now supports `extra` params for job delay and deduplication
* When Echo identifies this type of param it creates a
  DelayedEchoNotificationJob that will be executed after `delay` seconds

Change-Id: Ib0c6789dfe42e9703a67835909e5932c0054089f
2020-10-28 12:11:15 +01:00
Thiemo Kreuz 8880df4123 Fix DiscussionParser failing in certain languages
It appears like the initial \h in this non-Unicode regular
expression matches parts of an UTF-8 character, destroying it.
This makes the final preg_match() in this method fail, when
$output is going to be used as a pattern.

Bug: T264922
Change-Id: Iaf240bc2e0808c2f57c1f8bab2589d3207915afe
2020-10-27 20:03:18 +01:00
jdlrobson b5dd7baa08 Item label can now use overflow hidden
Since the icon is applied to the link element it is now possible
to apply overflow hidden to the label itself when its wrapped in
a span.

Bug: T264339
Change-Id: Ifdc1d152702c1f5338fd2969cccf07971d622fc7
2020-10-21 10:04:40 -07:00
James D. Forrester 61cda882f5 Drop private EchoCachedList::ONE_DAY, unused
Change-Id: I14e53bcd593161c2fb6e29a5d280615d8694ebb4
2020-09-20 13:38:01 +01:00
Reedy 2afb728a10 Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I506e43629a30ef34c9154b8212878255de7d90b9
2020-09-19 21:26:38 +00:00
jgiannelos 4abfbd3c96 Normalize eps_topic
* DB changes
 - Create a table for push topics NameTableStore
 - Add a foreign key on subscriptions to normalize push topics

* Implement NameTableStore to normalize topics
* Update DB query joins to include topic from foreignkey
* Adapt code to use IDs instead of the actual topic

Bug: T261756
Change-Id: Ia7589f4a607993352d45b2dd3bcb3867d12d6e97
2020-09-14 15:52:23 -04:00
Reedy 257de880c1 Make use of BatchRow(Iterator|Writer)::setCaller
Bug: T261014
Change-Id: I51df93a9ed998c25e632c35b0fcc531615ddfb80
2020-09-05 03:45:55 +00:00
Reedy 82896eff62 Ignore usage of $wgUser
Bug: T262110
Change-Id: Ia4a24d0216ce33d3ae915c12619c149d54d321b2
2020-09-05 03:16:37 +00:00
jenkins-bot 763e7ab1bb Merge "Create push subscription manager group/right to clean up dead subs" 2020-08-24 10:23:31 +00:00
Michael Holloway 3513c642dd Create push subscription manager group/right to clean up dead subs
Creates a new push-subscription-manager group and an associated
right, manage-all-push-subscriptions. The purpose of this is to
allow privileged accounts to purge expired subscriptions from the
database on behalf of other users. A user with this right will be
permitted to delete any subscription from the DB based on the token
alone. For all other users, deletion requests will be limited to
those associated with the requesting user's central ID.

This right will be granted to a bot account on Metawiki associated
with the Wikimedia push notifications service, and the push
notifications service account will make push subscription delete
requests to the API for subscriptions for which vendor APIs return bad
subscription responses.

Additionally, the providertoken parameter to ApiPushSubscriptionDelete
is updated to allow multiple providertoken values.

Bug: T259148
Change-Id: Ia6c17588ee94e6be74e5e3a75eb33e38f172fc93
2020-08-20 17:08:48 -04:00
Michael Holloway 74c1a5bbc7 Collect baseline event and notification stats
Adds statsd counters for events and notifications, both overall and by
type. (Events and notifications have a one-to-many relationship, as
notifications may be created for multiple users per event.)

These are specifically of interest to estimate the potential volume of
notifications to be handled by the new push service.

Bug: T260836
Change-Id: I41974cd30a90c674f56003e15d540a5581d19c7d
2020-08-20 13:55:03 -04:00
Mateus Santos c188dac23f push: send apns topic when present
1) send apns topic when present in subscription metadata
2) check if subscription metadata is a valid JSON string
3) make epp_id column at echo_push_provider table auto_increment,
otherwise it will fail when trying to add a second row in the table

Bug: T259394
Change-Id: I785435e9f2d4ba9c14977d431d271f0fa2d0c795
2020-08-18 13:21:20 +00:00
jenkins-bot abb59057e9 Merge "Fix query condition building in EmailBatch" 2020-08-18 01:13:25 +00:00
DannyS712 d24df030a3 Remove legacy ApiBase::getTokenSalt() overrides
Method was removed in 1.24, extension requires MW 1.35+,
so overrides aren't used

Change-Id: Ia543a06c3fcefce3429c0031b813b742feee76f1
2020-08-15 05:30:58 +00:00
Matěj Suchánek 52f4babb26 Fix query condition building in EmailBatch
array_plus (+=) does a union over keys and does not merge
sequential (integer) keys like array_merge. This probably
broke the "do not notify me of seen notifications" feature.
Use cleaner syntax for query building.

Change-Id: Ie0e8d562aec94060c18eed989bb54a9484ccb5d3
2020-08-14 11:18:07 +00:00
jenkins-bot aa1f1801e4 Merge "Create and enforce a config setting for max subscriptions per user" 2020-08-13 17:03:05 +00:00
jenkins-bot 79f06475f3 Merge "Use more canonical (object)[] instead of new stdClass" 2020-08-13 11:03:26 +00:00
jenkins-bot 63e2dd4efa Merge "Remove calls to ParserOptions::setTidy()" 2020-08-13 10:19:17 +00:00
Thiemo Kreuz e5fead8b42 Use more canonical (object)[] instead of new stdClass
Both styles create the exact same object. Casting an array to an
object creates an stdClass object as well. The main benefit of this
syntax is that there is much less repetition. Everything is one
token instead of individual lines, where each line might contain a
typo.

Change-Id: Id43fa2c4b6bd5d9dbc60008427d4a9e14ae3811c
2020-08-13 09:58:14 +00:00
Thiemo Kreuz 9474b9c942 Remove Phan exceptions reported as unused
Change-Id: I89fa328e8878d64887518a3f49145b19ea599676
2020-08-13 09:25:05 +00:00
C. Scott Ananian 37261f977e Remove calls to ParserOptions::setTidy()
ParserOptions::setTidy() was already a no-op in MW 1.35, and
Echo already requires MW >= 1.35 in extension.json.
ParserOptions::setTidy() was deprecated in MW 1.35 and will be removed
in a future release.

Bug: T198214
Change-Id: I6a5378a42a6cf035296ad549525c25438803970a
2020-08-12 23:41:49 -04:00
Michael Holloway 15d48278be Create and enforce a config setting for max subscriptions per user
Creates a EchoPushMaxSubscriptionsPerUser config setting (default: 0)
that controls the maximum number of subscriptions a user may associate
with the user's central user ID.

The setting is enforced in EchoPush\SubscriptionManager::create().

To allow creating push subscriptions for development, set
$wgEchoPushMaxSubscriptionsPerUser to a positive integer value in
LocalSettings.php:

 $wgEchoPushMaxSubscriptionsPerUser = 10;

Bug: T259150
Change-Id: Ib97b6b6cbb8161dd75dad92c54b4fe4fff80c421
2020-08-12 17:58:11 -04:00
jenkins-bot 0d414cf1ec Merge "Add all ResourceLoaderModules using supported hook" 2020-08-10 20:21:21 +00:00
Thiemo Kreuz d046adfd99 Remove obsolete property name from @var docs
Change-Id: I72faac7f0f88b0e3c4f145aa1def0acae0398488
2020-08-10 12:53:14 +02:00
Ammar Abdulhamid 95a0dff88c Add all ResourceLoaderModules using supported hook
PersonalUrls hooks is not meant to be used to add RL modules,
its documentation says it's meant to "alter the user-specific
navigation links (e.g. "my page, * my talk page, my contributions" etc)."

Echo is already using BeforePageDisplay hook to add modules, let's
now register all our modules via that

Bug: T259872
Change-Id: I12616a9947ea0e574287443361e2180c42e48d4b
2020-08-09 00:35:56 +01:00
Amir Sarabadani 532fdbf294 Stop using ResourceLoaderTestModules hook
This hook is deprecated and we should use QUnitTestModule in extension.json instead

Bug: T232875
Change-Id: I7b3e22856adc64ee36e0b696e2371bb9673e4899
2020-08-03 13:18:29 +02:00
jenkins-bot d8d0e52c03 Merge "Use user IDs, not User objects, for reverted-user-id" 2020-07-28 12:11:24 +00:00