Commit graph

391 commits

Author SHA1 Message Date
Derick Alangi f402ecd31f Echo: Fix case mismatch for function/method calls
PHP doesn't care much about the name (in terms of case sensitivity)
but I think we should make sure the names of the method should be as
they're in their definition.

Change-Id: I6e38d8be64efaec4200471f2d3007275d7ddecec
2019-06-11 22:46:24 +01:00
Max Semenik 538be81712 tests: Remove local override for editPage()
As far as I can see, it doesn't do anything different from the
parent class.

Bug: T225327
Change-Id: Id52ebd2faa179de39111221e55435e2e6e13aa05
2019-06-10 13:17:09 -07:00
jenkins-bot c5ed6315cc Merge "Remove usage of deprecated Revision class in Echo" 2019-05-09 20:56:17 +00:00
jenkins-bot 703aac8e75 Merge "Test that checks for welcome notification" 2019-05-09 17:41:57 +00:00
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
Derick Alangi 8e5aa13a73 Remove usage of deprecated Revision class in Echo
Class Revision is deprecated and in this patch, replaces
usage with appropriate classes; RevisionRecord, RevisionStore,
etc.

Bug: T221163
Change-Id: Icfc85167a636bef95daab236ab80113c1a3cf41b
2019-05-08 19:50:58 +01: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
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
ephemeralwaves 917d003397 Test that checks for welcome notification
Added a test that creates a new user and checks that they have a welcome message when notices is clicked.

Bug: T217051
Change-Id: Ia5808ebcedcd91f740cce646f4aa0576ef6d378f
2019-04-30 21:00:53 -04: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
Stephane Bisson 3a7e655229 Unbreak TalkPageFunctionalTest
* Clear echo_event before the test. Otherwise it contains
  a 'thank-you-edit' event that offsets everything.
* Use standard $this->db
* Use standard ~~~~ signature

Bug: T67336
Change-Id: Idd09aa107d01038d03b689d9086f65a9fb7b653a
2019-04-19 14:17:01 -04: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
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
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
Krinkle 1278c66673 Mock IDatabase instead of DatabaseMysqli
PHPUnit 4 on HHVM is unable to create a mock for a class that uses variadic
arguments in one of its methods. Details at I0e027f5ec66 in core.

To work around this, IDatabase will continue to document it the old-fashioned
way so that Phan can analyse it correctly, and also so that PHPUnit can
mock it properly.

Change-Id: I4b8f2b8a8bb54b71d8b4836c3663f1a646ece1bd
2019-04-07 23:29:03 +00: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
James D. Forrester 38b41c0f98 build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I6747b5e36f64d681b6f83461f0ebb9c9f88bea86
2019-04-03 15:57:20 -07:00
jenkins-bot 2c128578ca Merge "Selenium: notices' flyout" 2019-04-01 15:40:18 +00:00
ephemeralwaves 2dec325d13 Selenium: notices' flyout
Test that checks if the flyout window appears when the notices badge is clicked.

Bug: T217051
Change-Id: Icf37b2908f26b2cb43c8c7ae0de4eca73a5a28a4
2019-04-01 15:19:21 +00:00
Kosta Harlan ffa887bd34 Re-enable DiscussionParser tests
These work now that I4c0d629da254ac2aaf31aae35bd2efc7bc064ac6 is merged.

Bug: T194632
Bug: T218388
Change-Id: If8031d488a67c423c7d4f4d3bf0f5e4126d3212a
2019-03-27 17:38:01 -04:00
Željko Filipin c054b6ddb0 Selenium: update and simplify README
Bug: T210726
Change-Id: I3dc028c36b98de68351ca754233a5bc2994e0f03
2019-03-26 16:27:06 +01:00
jenkins-bot a0e0cffe48 Merge "Selenium: the first test for Special:Notifications" 2019-03-25 16:08:36 +00:00
ephemeralwaves 319808de5d Selenium: the first test for Special:Notifications
Open the notifications page and check that the notification heading is present.

Bug: T217051
Change-Id: I357e83eca9f6d6fe380ec6996fb557d578a76912
2019-03-25 15:47:38 +00:00
Kosta Harlan c2c9ed0926 Disable DiscussionParserTest until we can figure out why it broke
Bug: T218388
Change-Id: I5cee1784ea6d89d8ecc51a055631a30c408af6be
2019-03-15 14:45:23 -04:00
Kosta Harlan 84d3f8b00c Remove problematic test case
Note, per T194632#5018823 it appears that replacing instances of
Benutzer:Schnark with User:Schnark cause the test to pass, so we should re-add
this test case once we've figure out why that's happening.

Bug: T194632
Change-Id: I8000c037c515283e46d4b530f8d91bdef35c7ace
2019-03-12 14:44:17 -04: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 dd3fc548bd Merge "Test that checks for alerts' flyout" 2019-03-05 13:28:02 +00: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
jenkins-bot a838836a23 Merge "Use explicit columns and avoid SELECT *" 2019-03-04 21:12:28 +00:00
ephemeralwaves 8212dfe2a3 Test that checks for alerts' flyout
Added a test that checks if the flyout window appears when the alerts badge is
clicked.

Bug: T217051
Change-Id: I5afbb6928a42ddf1c71dec13c4559189d7c31f28
2019-03-04 13:26:22 -05: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
Aaron Schulz bb0ca321df Convert caching to WANObjectCache
Change-Id: I6c0315aa6e24c573cf9a8410ff21471ed3da60d1
2019-02-28 21:56:38 -08:00
Thiemo Kreuz afdcce5059 Add type hints and remove unused code from tests
This patch contains a series of different clean-ups in test classes.
Some documentation is added as well as soft and hard type hints. Note
all this is exclusively done in tests. So if the CI is fine with it,
it can't be wrong. Right? ;-)

Change-Id: Ibcf1f65f48ac0fb41837c47672dddfd70302e9fd
2019-02-20 19:16:33 +00:00
Thiemo Kreuz 5941ef476c Replace @expectedException with $this->expectException()
The @expectedException annotation got deprecated in PHPUnit 7.5, and
removed in PHPUnit 8.0. This was done because the annotation does have
two disadvantages:
* The class name is encoded in string, where it is not easy to find for
  all IDEs and tools.
* it did not allow to say exactly *when* the exception is expected.

Change-Id: I96862a18874f36355e817accd64d8703c1965c86
2019-02-19 20:54:15 +00:00
Thiemo Kreuz c36d2bd0e8 Prefer the …::class feature over hard-coded strings in all tests
The codebase already used the …::class feature in many places. So this
is more for consistency than anything. The …::class feature makes it
much easier to do refactoring in the future.

Note this patch is exclusively touching tests. That should make it
relatively easy to review this. As long as the CI is fine with it, it
should be ok. Right? ;-)

Change-Id: I4d2adee76b4adbc83b2061161fd4e863ba833fcb
2019-02-19 14:35:14 +00:00
Ed Sanders 7ed027ddcf build: Update eslint-config-wikimedia to 0.10.1
Change-Id: I776585adab962c2b1d353d18d3a02b6662941b13
2019-02-06 01:42:53 +00:00
Ed Sanders 4d03a4856d Update eslint-config-wikimedia to 0.9.0
Change-Id: Icd7b0f4ca54275c31eb61a759e2c3c9ce0a18952
2018-11-27 22:48:32 +00:00
Ed Sanders 17126b2ab1 Remove obsolete aliases from closures
Bug: T208951
Change-Id: If51fc6d50b9755c779fd0bf1be7bb0fe276539ea
2018-11-12 13:56:38 +00:00
jenkins-bot f75d5d120f Merge "Add method scope visibility" 2018-11-02 23:55:06 +00:00
Umherirrender 81183a6d86 Add method scope visibility
Change-Id: Id4fe59155d6e0fa2ef1ccf4dc46ee1f109265246
2018-11-02 18:47:39 +01:00
jenkins-bot 92ed4e312c Merge "Make notifyAgent a per-type property rather than per-event" 2018-11-02 15:09:19 +00:00
Roan Kattouw de536d09d9 Make notifyAgent a per-type property rather than per-event
Specify which notification types allow notifying the event agent in
$wgEchoNotifications, and stop specifying it in the event_extra data.

Putting 'notifyAgent' => true in event_extra will still work, but is
discouraged.

Change-Id: I4f558654ec23757dd4ecd6986eb3e9a5593f5386
2018-10-29 15:41:51 -07:00
jenkins-bot 512a0904c5 Merge "Avoid use of IDatabase::insert() return value" 2018-10-28 21:42:07 +00:00
Aaron Schulz bbf0e1fade Avoid use of IDatabase::insert() return value
Change-Id: I36a18d9ff315928555bef7ab93283ec72aeef9f7
2018-10-26 15:44:57 -07:00