Commit graph

1067 commits

Author SHA1 Message Date
Thiemo Kreuz be5919f623 Make use of the PHP 7 ?? operator where it makes sense
To my knowledge in all the places I'm touching in this patch the new
code is functionally identical to the old one.

Change-Id: I0ffa96d2f9cb9bf932f68b689244051c96c17ad9
2019-05-09 15:57:16 +00:00
Stephane Bisson f5f59a503b Use wikiId both server and client side
When creating the various notification sources,
the server was indexing them with wfWikiID() but
the client was using wgDBname to find which one
is local and which are remote. On some wikis,
like TWN, wfWikiID() includes a db suffix so
the JS app on Special:Notifications is failing to
find the local source and errors.

Bug: T167336
Change-Id: Id60f723b615fb7db54a6f17b1c1be20dfe98e36c
2019-05-08 09:03:28 -04:00
Derick Alangi c4890ca86f Remove usage of deprecated database access code from Echo
Bug: T221164
Change-Id: Ib7cfe384f4104dbaeed5ba6659e81555eb810f97
2019-05-07 20:46:07 +00:00
Stephane Bisson 13956265c1 Make phan ignore JsonSerializable redefinition
Change-Id: I1cffc88a3f4ea4290892c0624a6f32e852cde1dd
2019-05-07 16:21:22 -04:00
jenkins-bot b8aaf37e4a Merge "Proactively delete echo_event rows when they become orphaned" 2019-05-02 19:45:49 +00:00
Roan Kattouw 0e4f4ffad9 Proactively delete echo_event rows when they become orphaned
When deleting echo_notification or echo_email_batch rows, also delete
the corresponding echo_event rows if no other echo_notification rows
or echo_email_batch rows refer to them.

Bug: T221262
Change-Id: I416ff107bd000a0cfac102408c993f8bec2d0286
2019-05-01 11:23:27 -07:00
Roan Kattouw 95172c2c7e Remove per-type notify-type-availability (make it category-only)
Bug: T221264
Depends-On: I74f660e88d18d5a27cc1e74f39316bb27aec1cbb
Change-Id: I12cc0312dbfd9a6923b64117e001841a7bfaaf17
2019-04-26 17:36:10 -07:00
jenkins-bot 0174b81a3a Merge "Remove all traces of cross-wiki beta feature" 2019-04-19 23:25:04 +00:00
Stephane Bisson 2fb8db3bca Remove all traces of cross-wiki beta feature
Bug: T221260
Change-Id: I447b5220220fdad68a55629ba5a532db720ca8da
2019-04-17 22:18:13 -07:00
Stephane Bisson 1017054b88 Cleanup transition flags
$wgEchoSectionTransition was introduced when we moved some notification
types between sections (alert, message).

$wgEchoBundleTransition was introduced when we made bundles dynamic
and expandable.

Both flags have been OFF for years and are not needed anymore.
This patch removes all traces of them.

Bug: T140710
Change-Id: I16a5d54b09e71997f80208db6f4fbdb040d03ab1
2019-04-17 22:07:14 -07:00
jenkins-bot 074ce90263 Merge "NotificationJob: make sure we retry to load the event from master" 2019-04-17 18:54:47 +00:00
Derick Alangi 7e5e63b1d5 Remove usage of deprecated cache code from Echo
Bug: T221165
Change-Id: Ib7512395b1cc4fd5e13a8d13bd966b1088f34374
2019-04-17 15:22:37 +01:00
jenkins-bot 9208a5b02e Merge "Revert "Email: embed icons as data uri"" 2019-04-17 01:13:02 +00:00
Sbisson a1aeebc5a6 Revert "Email: embed icons as data uri"
This reverts commit 7121b9c491.

Reason for revert: Data URIs don't work in gmail

Change-Id: I8f9a6a19ba32f1e078d61d1692a102912f5039a7
2019-04-17 00:30:17 +00:00
Stephane Bisson f361425a34 NotificationJob: make sure we retry to load the event from master
EventMapper->fetchById() has retry on master built-in but it doesn't
kick in in a Job because the load balancer is a new instance and doesn't
know about previous writes.

This change makes the job always read from master to make
sure the event is found. It is going to write to master
right after anyway.

Bug: T204894
Change-Id: I9a2873234f1dd5416e6c2bedeb904880d1f79562
2019-04-16 17:06:48 -07:00
Roan Kattouw f3c9a0a255 AttributeManager: Check notify type availability before notifying
It was sort of checked in an implicit and roundabout way, in the sense
that the preferences page checks this and forces the relevant
preferences to on or off. But this was difficult to discover, and it's
not clear if this works correctly when defaults change.

Instead, explicitly check whether the requested notify type is available
for the event's category. Also rewrite the entire method to use
array_filter().

Change-Id: I9502a42fc705b2e56ef5edab433f1804f2924359
2019-04-12 18:00:04 -07:00
Stephane Bisson 61a839315a Use echo_event.event_page_id to find events to moderate
When pages are deleted or undeleted, their associated
Echo notifications also need to be marked as deleted
or undeleted. This is done by looking up the
echo_target_page table.

With this change, echo_event.event_page_id is also included
in the search. This way, all the events that don't use
target pages are also moderated when needed.

Bug: T217452
Change-Id: I277fca68ce088ab564e76ed9dfb2134ab3be4c4a
2019-04-11 10:48:49 -04:00
jenkins-bot 9c3b122b83 Merge "Do not fail on unknown revids in mention-summary events" 2019-04-11 11:12:51 +00:00
Stephane Bisson 7121b9c491 Email: embed icons as data uri
When the location on disk of an icon is known,
load its content and turn it into a data uri
for the <img> tag.

Otherwise (when it's only configured with a url),
use the url in the <img> tag.

Bonus: the rasterized icons were a bit blurry
and they are now crisp.

Bug: T55479
Change-Id: I8b5d7f09d8181f22927b8d4712505212ea1a10b1
2019-04-10 13:33:50 -04:00
jenkins-bot 3dbfbfb670 Merge "Add phan" 2019-04-10 17:29:04 +00:00
Daimona Eaytoy e21e3b4a8d Add phan
Change-Id: I65ae6adc10941c05a2646e551b1baa829e4e8654
2019-04-10 18:51:59 +02:00
jenkins-bot 7d7531c0e5 Merge "Remove unused messages" 2019-04-10 03:58:36 +00:00
Roan Kattouw f0476b7009 Remove unused messages
Also clean up references to nonexistent messages in qqq.

Change-Id: I3811da1b1420318e5bf747f26244a4bb00d68cc5
2019-04-10 03:37:18 +00:00
jenkins-bot f0cb367140 Merge "Don't use {$this->type} in message keys where not needed" 2019-04-10 03:25:23 +00:00
jenkins-bot 22c08547a6 Merge "Add visible help link for Special:Notifications" 2019-04-09 15:32:14 +00:00
Shivanshbindal9 a09db3ea59 Add visible help link for Special:Notifications
Bug: T200184
Change-Id: Iaf321f88322e8a9686be62eb9b055c6544cf0ad6
2019-04-09 10:27:40 -04:00
Roan Kattouw 9832d2af8b Don't use {$this->type} in message keys where not needed
It makes the code less clear and makes message keys harder to grep for.

Change-Id: I0641e7cd0b8262d8b6548a06d505e19c1b5a1fb0
2019-04-05 17:33:28 -07:00
Stephane Bisson 754338fe48 Convert PresentationModelSection from trait to class
This trait was using private fields from its host classes
($this->event, $this->language). It created a weird coupling
situation where the host class uses the trait and the trait
uses the host class. Effectively a circular dependency.

Also, phan is complaining about it in
I65ae6adc10941c05a2646e551b1baa829e4e8654

Change-Id: Ib2796b7ca62ecd7ece19583d7ca83e4252a5d878
2019-04-05 16:57:48 -04:00
Roan Kattouw d002512f09 Pass viewing user as $3 to email subject messages (for GENDER)
Do this by default in EventPresentationModel so it automatically works
for all email subject messages.

Update messages to use this parameter. Also update email subject
messages that were trying to use parameters that didn't exist, and fix
message documentation that was completely wrong about what the
parameters were.

Also update translated messages to account for parameter shifts (in many
cases, these messages were using the wrong parameter or a nonexistent
one).

Bug: T219620
Change-Id: Ia420c4db13c95d91e1bfc4c7950942df5858379b
2019-04-04 14:58:43 -07:00
Umherirrender 04fda8aab6 Do not fail on unknown revids in mention-summary events
No revision, nothing to format

Bug: T219155
Change-Id: I701731b0eb3c825e98bb04896375e9f87b490564
2019-03-27 19:26:03 +01:00
Umherirrender 4b75dc8d0f Use ::class on \DatabaseUpdater::addPostDatabaseUpdateMaintenance
Change-Id: I2e3b12645818ca97ff991446cc5f4ad4c9c07e6e
2019-03-15 19:28:29 +01:00
jenkins-bot ad3c072d87 Merge "Use php null coalesce operator ??" 2019-03-12 21:07:20 +00:00
jenkins-bot 09bfec0781 Merge "Avoid use of func_get_args()" 2019-03-12 20:07:48 +00:00
Umherirrender c3d0760405 Use php null coalesce operator ??
Change-Id: Icb7d61b0b9040ee08caedef90b4dd2b65d403540
2019-03-12 21:04:00 +01:00
Kunal Mehta 0355c73c91 Avoid use of func_get_args()
Change-Id: Id55f26b3cf86af5ba628156a68e0c93bd5918b7a
2019-03-09 17:54:04 -08:00
Olena23 8421ce0121 Fix typo
Fixed typo occurd-occured

Bug: T201491
Change-Id: Icae706f162ed212daf4c800068de3932d2f8d567
2019-03-08 15:36:55 +02:00
Umherirrender a10978b7af Pass IContextSource to parent in NotificationPager
It is already called with a context in SpecialNotifications
Set context on SpecialNotificationsMarkRead and pass title to html form
to pass texts

Change-Id: I24eb85648580ac1a4df5e7587806bad57c141785
2019-03-07 17:57:34 +00:00
jenkins-bot f5559a72cc Merge "Remove notification_bundle_display_hash" 2019-03-06 19:59:25 +00:00
Roan Kattouw 91465ef753 Remove notification_bundle_display_hash
Also remove fetchNewestByUserBundleHash() because it's now unused,
and remove the echo_notification_user_hash_timestamp index which
existed specifically to support that function's DB query.

Bug: T143763
Change-Id: I74be8f156bc14d0e189d328953d17dc26cdb697b
2019-03-06 10:29:05 -08:00
jenkins-bot 08a9f9e9c4 Merge "Remove notification_bundle_base" 2019-03-06 14:05:23 +00:00
jenkins-bot 69ca0fac71 Merge "Migrate and remove event_page_namespace and event_page_title" 2019-03-06 14:00:26 +00:00
Derick Alangi 3971e32f1b Code improvements for includes/ **only** directory
This code improvements seeks to improve on code readability, consistency,
maintainability and efficiency.

Change-Id: I4f07886044e9a75824f9e7ddad039f3112b1c4a1
2019-03-05 18:58:52 +01:00
jenkins-bot b93e548d91 Merge "Fix off-by-one edit count for ThankYouEdit notification" 2019-03-05 01:58:46 +00:00
Stephane Bisson 408721a357 Fix off-by-one edit count for ThankYouEdit notification
Incrementing user edit count was moved to a deferred update in
I0d6d7ddd91bbb21995142808248d162e05696d47
That causes the notification to lag behind, and the thank you notification is
sent for your first edit on the second, you 10th on the 11th, etc.

This change simply assumes one more edit than the current count unless it is
running from the CLI (this is needed for the test to continue to work).

Since the update job is mergeable, it is possible that a certain value will
be skipped and the notification for it never sent. See task for moe details.

Bug: T209541
Change-Id: Iea61b0f525be25f63f50582933a16a79a52e141f
2019-03-04 20:39:22 -05:00
Roan Kattouw ae75a8118a Remove notification_bundle_base
No longer used in the new bundling system.
Also removes indexes that contain bundle_base.

Bug: T143763
Bug: T131415
Change-Id: Ibf94cdc471a11cb14995fee6a55af0d227b50aa5
2019-03-04 13:22:17 -08:00
Roan Kattouw b73522549d Migrate and remove event_page_namespace and event_page_title
By running updateEchoSchemaForSuppression.php as an updater.
The patch-*.sql files already existed, they were added
in 2013(!) by 34fbeaf8c but never applied.

Bug: T136427
Bug: T50059
Change-Id: Ied049681df4bab325f069c3a68cf704ee9a8f2c9
2019-03-04 13:12:52 -08:00
jenkins-bot a838836a23 Merge "Use explicit columns and avoid SELECT *" 2019-03-04 21:12:28 +00:00
jenkins-bot 8de5066b24 Merge "Convert caching to WANObjectCache" 2019-03-04 15:06:35 +00:00
Umherirrender 1b5308ba81 Use explicit columns and avoid SELECT *
Change-Id: Ibde033784aee5adc13fae6f1d395d9464f54fefd
2019-03-02 22:39:53 +01:00
Umherirrender 8ce0cc171d Fix UserMerge integration for use with table prefix
This fixes tests, because EchoHooks has "echo_event.*" which is invalid
with table prefixes, like done in unit tests
Added EchoEvent::selectFields() for future use and to replace more
SELECT *

Bug: T217487
Change-Id: I51cb46812431635d11780633dc7d807cd04f813d
2019-03-02 22:05:22 +01:00