Commit graph

420 commits

Author SHA1 Message Date
jenkins-bot 19d88be6cf Merge "build: Update linters" 2019-12-12 17:52:35 +00:00
Ed Sanders 80ddee3956 build: Update linters
Change-Id: I713aafb891306fc21a776a7d4622c6a039798753
2019-12-12 11:20:49 +00:00
Pppery db78c1552e Add support for watchlist events
Bug: T203941
Change-Id: I9bcd13cb0a547393696dde0e977b7761cc1fea68
2019-12-11 16:39:02 -05:00
Daimona Eaytoy c19c88567b Hack: back-compat for PHPUnit's Stub interface
Until PHPUnit7, the Stub interface came from phpunit-mock-object, and it
was at PHPUnit\Framework\MockObject\Stub. Then, phpunit-mock-object was
merged into PHPUnit, and:
 - The interface above was moved to PHPUnit\Framework\MockObject\Stub\Stub
 - The FQSEN above started pointing at a completely different interface
 
This is a temporary hack to allow upgrading to PHPUnit 8, and MUST be
removed as soon as the upgrade is complete.

The :string typehint is also necessary in PHPUnit8, and it will work
with PHPUnit 6 as well.

Bug: T192167
Change-Id: I07cebd07088bced5c5ddc62936f0098dfa39e151
2019-11-18 16:58:18 +00:00
jenkins-bot 4b6fc85f39 Merge "Use absolute class names in @covers tags" 2019-10-24 18:37:15 +00:00
jenkins-bot 41fd67da53 Merge "Prefer strict assertSame() for all numeric assertions" 2019-10-24 07:12:31 +00:00
jenkins-bot 962f958a8c Merge "tests: Kill last use of deprecated getMock()" 2019-10-23 23:26:31 +00:00
Thiemo Kreuz 229c3d0fdd Remove non helpful (auto-generated) comments
None of these comments explains anything that wouldn't be obvious
from the code itself.

Change-Id: Ibcf50d401999ae76f315df2d2d27097a39f41bbd
2019-10-23 12:31:35 +02:00
Thiemo Kreuz bc3dabf828 Prefer strict assertSame() for all numeric assertions
assertEquals() does not compare the type. It can not only be a float,
it can even be a string. E.g. 9 and '9' are considered equal.

Worst case scenarios are:
* 0 is considered equal to any "falsy" value, including the empty
string.
* 1 is considered equal to true.

assertSame() does not have any of these confusing edge-cases.

Change-Id: Ib6af0fefbbd8856adcf27844bb8ddd8e33ed3f9d
2019-10-23 12:28:30 +02:00
Thiemo Kreuz 967a0b54e9 Use absolute class names in @covers tags
Not all tools require these to be absolute, full qualified class
names. But some do. This does make the code more compatible with all
kinds of tools.

Change-Id: Ie7f9d9469b7a48b2fe908d3428fca9ec0120f855
2019-10-23 12:23:09 +02:00
Max Semenik 94646b0de0 tests: Kill last use of deprecated getMock()
Change-Id: I6bb9fcce07389868544b25875d95a1af628a1136
2019-10-23 09:02:12 +00:00
James D. Forrester abaff73626 build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: Ib66b0ad1b3929bf7e49eb40a3d5463b0d8b2280b
2019-10-10 09:29:24 +00:00
jenkins-bot cd6a340ce8 Merge "Dormant mobile notifications overlay lives in Echo" 2019-10-09 19:50:57 +00:00
jdlrobson d3c0494a17 Dormant mobile notifications overlay lives in Echo
This code will be enabled when Iba1d7863171268066bf7597182c57a0a2041497f
relinquishes the responsibility for rendering the Echo notification badge
and wiring up of the related JS.

It makes 3 assumptions:
1) Minerva will expose a VERSION property on the skins.minerva.scripts module
to tell Echo it can begin control of the functionality
2) A new hook `SkinMinervaReplaceNotificationsBadge` will run on the server side
allowing Echo extension to render the Notifications badge in Minerva.
3) A new client side hook (echo.mobile) will fire whenever the Echo dialog is opened or
closed.

All code relating to Echo inside MobileFrontend and Minerva is
moved here.
CSS for the modules is kept in Minerva as skinStyles

This code remains dormant until Iba1d7863171268066bf7597182c57a0a2041497f lands.
It pre-registers a "to-be-created" hook SkinMinervaReplaceNotificationsBadge that
substitutes the Minerva badge.

It also watches the export value of skins.minerva.scripts for a VERSION value - when
this appears it will take the signal that it should manage the frontend code.

In the new system the mobile specific code is limited to the mobile version of
Minerva. The desktop version of Echo loads on Minerva desktop - presenting an
opportunity in future to consolidate both implementations to use the same component.
The mobile version of Vector and Timeless for example will load the mobile overlay
(with existing styling issues that we don't need to worry about right now given
we don't officially support skins other than Minerva as mobile)

Testers:
* Check require( 'ext.echo.mobile' )(); inside initMobile
inside ext.echo.init does not fire until
Iba1d7863171268066bf7597182c57a0a2041497f is checked out.

Depends-On:  I1a66939d2b596094b419de40b370e79f09c85581
Bug: T221007
Change-Id: I09c27a084100b223662f84de6cbe01bebe1fe774
2019-10-09 12:36:11 -07:00
Max Semenik 7e9e549743 Use PHPUnit 6 class names
Bug: T192167
Change-Id: Id309ad5933371dd835ec431ded80f650e228099c
2019-10-06 15:23:15 -07:00
Max Semenik 031e6d37bf Drop old PHPUnit rudiments
Change-Id: I0a69ee7826227ee195415e43dc688f76602ed02b
2019-10-04 20:54:45 -07:00
mainframe98 b942fa3c65 Inject PermissionManager into Userrightspage in tests
With I40fc8a709de96aceee14a10c973cd5b0a9a6f063 UserrightsPage
now requires the PermissionManager service to be injected.

Change-Id: Ibf3728c1e143787fb35b88ad8a8d5aabc8fadcb8
2019-09-13 18:24:52 +02:00
Kosta Harlan 15d36ccae5 Remove global usage in UserNotificationGateway
As noted in Ic22075bb5e, UserNotificationGatewayTest relies on the presence of
globals. When Ic22075bb5e is merged, UserNotificationGatewayTest will fail in
CI. This patch injects the configuration object into UserNotificationGateway.

Change-Id: I9c15a588a76a41a3ebfb59dac7f0761f756008ff
2019-08-30 22:58:41 +02:00
jenkins-bot 42fd16e0f3 Merge "Update for MessageCache as a service" 2019-08-19 15:36:45 +00:00
Aryeh Gregor 7290434158 Update for MessageCache as a service
Change-Id: I546eda0377f3a50843144b1450d3fbe8e4e02a8a
2019-08-18 11:46:11 +03:00
Kosta Harlan efd759402f Skip broken Selenium test
Caused failure in
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Echo/+/524520#message-7f1addb6b8b09919581014fe18c6dddef32fb078

Bug: T227009
Change-Id: Iae088bc7c966f927a15d06a4de5966a76913dbe4
2019-07-30 16:54:31 +02:00
Dayllan Maza b3df45dc34 Add option to mute/unmute notifications on Special:Mute
The hook (SpecialMuteModifyFormFields) is used to append
the option to mute/unmute echo notifications from a specified user.

Special:Mute handles posting and saving the fields, the only
requirement is that the field name is the same as the property
that wants to be modified, in this case 'echo-notifications-blacklist'

Bug: T220163
Depends-On: I2b3eee0802cb086091f35ecce13ae77a8e7d518d
Change-Id: I77b3ccfdce9b501eb8ecd58c0d7bbecb78029a7e
2019-07-18 15:47:24 +00:00
Amir Sarabadani 7a27d13a7b Move unit tests, round II
Change-Id: I4a419ae44a73ece55f2519dddc1aac4bedebc9e4
2019-07-15 18:10:01 +02:00
libraryupgrader 4bf8a6736a build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 24.0.0 → 26.0.0

npm:
* set-value: 2.0.0 → 2.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* union-value: 1.0.0 → 1.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* mixin-deep: 1.3.1 → 1.3.2
  * https://npmjs.com/advisories/1013
  * CVE-2019-10746

Change-Id: I6d3efdf65c207b98447565e2df6f0698aaa8ea6b
2019-07-14 10:57:49 +00:00
Amir Sarabadani 1c93cba790 Move unit tests to the new structure
Change-Id: I02e2a33149eee859ec10ab7f8265609b0f17d1cc
2019-07-12 18:22:52 +02:00
ephemeralwaves 05f3e66a9d Selenium: Fix failing test by only running tests tagged @daily
Changed `selenium-daily` npm script to only run tests tagged `@daily`
and removed `it.skip` on tests failing in beta cluster.

Bug:T227009
Change-Id: Id2edbfd941df098d326fa30ed9dc9f68e228f021
2019-07-05 10:58:19 +00:00
Željko Filipin e76e9f9b5c Selenium: Fix failing Jenkins job by disabling failing tests
Bug: T227009
Change-Id: I5d2fcc1e6f50e73375c834e1167726273c82025c
2019-07-01 17:49:29 +02:00
jenkins-bot c2669ba0b3 Merge "Selenium: Test that checks for user mention alerts" 2019-06-19 10:42:06 +00:00
ephemeralwaves dd4539b522 Selenium: Test that checks for user mention alerts
Check that a user gets an alert when their username is mentioned by another user.

Bug: T224894
Change-Id: I303e10a40d1092e4b9f81deef0f1ac2af6f7a435
2019-06-19 10:23:22 +00:00
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