Commit graph

304 commits

Author SHA1 Message Date
jenkins-bot bb453d23e3 Merge "NotifUser: Redo caching strategy for multi-DC compatibility" 2018-06-02 17:10:20 +00:00
Roan Kattouw d90e2d1066 NotifUser: Redo caching strategy for multi-DC compatibility
To use WANObjectCache correctly in a multi-DC-safe way, we need to use
getWithSetCallback() to read data, and call delete() when it changes.
NotifUser's caching of notification counts and timestamps relied
heavily on set() calls, and so wasn't multi-DC-safe.

Changes in this commit:
* Rather than caching counts/timestamps in separate cache keys, and
  using separate cache keys for each section (alert/message/all), put
  all this data in an array and store that in a single cache key.
  This reduces the number of cache keys per user per wiki from 6 to 1.
* Similarly, use a single global cache key per user. The global check
  key for the last updated timestamp is retained, so we now have
  2 global cache keys per user (down from 7)
* Remove preloading using getMulti(), no longer needed
* Move computation of counts and timestamps into separate compute
  functions (one for local, one for global), and wrap them with
  a getter that uses getWithSetCallback().
* Use TS_MW strings instead of MWTimestamp objects internally, to
  simplify comparisons and max() operations.
* Make existing getters wrap around this new getter. They now ignore
  their $cached and $dbSource parameters, and we should deprecate/change
  these function signatures.
* In resetNotificationCounts(), just delete the cache keys. In global
  mode, also recompute the notification counts and put them in the
  echo_unread_wikis table. We could also set() the data into the cache
  at this point, but don't, because you're not supposed to mix set() and
  getWithSetCallback() calls and I don't want to find out what happens
  if you do.

Bug: T164860
Change-Id: I4f86aab11d50d20280a33e0504ba8ad0c6c01842
2018-05-30 17:49:48 -07:00
Roan Kattouw 6cdebeb6ab tests: Delete the rspec tests
They keep failing intermittently in CI.

Change-Id: I4370eb0169b9dbd3a6578a94700c85d3b53ef933
2018-05-29 16:56:09 -07:00
Roan Kattouw 36d250da85 rspec: Use environment variables for user+password
Change-Id: I20273f1be7d11614879144a495c7853b6459e8b2
2018-04-30 15:46:01 -07:00
Roan Kattouw 2988b0ac04 rspec: Update wiki password for Jenkins
Apparently this changed. We should really use the env vars for this.

Change-Id: I4c4147ff6cc64d276588a16842bf436cb45e575a
2018-04-30 15:35:29 -07:00
Kunal Mehta 23a06fa5d4 tests: Remove expectations for methods that don't exist
These trigger warnings in PHPUnit 6.

Change-Id: I01ddd139f1226c1a905763cd98cb4ddb5242f4bf
2018-04-12 16:21:09 -07:00
Aryeh Gregor 86b4ed5c56 Remove call to doLogin(), which does nothing
I805520e5 is removing all callers from core.

Change-Id: I56025a9c64406f44cb157a17e308da358de0da47
2018-04-11 17:11:27 +03:00
Max Semenik 6f6e5062fe Don't ping from user talk links in summary
As discussed at T189034

Change-Id: I86f36ab55c0e03ba3bbd2ea1ee94ce3056d91e30
2018-03-08 14:36:58 -08:00
Max Semenik 9874e2d024 Allow to avoid pinging from summaries by prefixing with :
Bug: T189067
Change-Id: I0596c575a42754d2b86fd2164e15b5f46b9bca9d
2018-03-07 20:56:48 +00:00
Željko Filipin 67f0bb4763 Update README file for Selenium tests
Bug: T187862
Change-Id: I43e0a91966b07377dbbc487c5b3980c34cf53ad3
2018-02-27 13:57:52 +01:00
jenkins-bot d814e9c4bf Merge "Ping users mentioned in edit summaries" 2018-02-23 18:44:46 +00:00
Max Semenik 467b13fe89 Ping users mentioned in edit summaries
Disabled by default for now.

Bug: T32750
Change-Id: I8012b82b6e27cc2612fb2302d0c9feb3f3623d62
2018-02-22 12:37:35 -08:00
addshore 1bb986c407 Use overrideMwServices in DiscussionParserTest
Bug: T135023
Change-Id: Ibcef80224c998239f57a9353fa97ba6129fc53b1
2018-02-01 16:14:59 +00:00
jenkins-bot 1ea8a2dc55 Merge "Add @covers tags" 2018-01-24 01:29:07 +00:00
Kunal Mehta 59a125fc38 Add @covers tags
Change-Id: Ib8cf432b58470c9218519639379c83254acef1c8
2018-01-23 16:44:45 -08:00
Phantom42 ac6622711b Fix multiple PHP class declarations in one file in tests
All files containing more than one PHP class were split into
multiple files.

extension.json was updated to match new class locations.

phpcs `OneObjectStructurePerFile.MultipleFound` rule was
re-enabled.

Bug: T177809
Change-Id: I6fc2ec9cc35e6bac5a7c44d94b0f1b1b40e6dba5
2018-01-22 16:27:07 +02:00
WMDE-Fisch 9635657ab4 When running Selenium tests, use wd/hub
Now it works on Mac, Windows and Linux.

Change-Id: Idf984c89f541a44ad522ff4d765dc58ada407797
2018-01-18 15:02:42 +01:00
Max Semenik 62703e4dc8 Don't use deprecated DatabaseMysql
Bug: T120333
Change-Id: I3150bcd9aeefa154fc064bcc8078419521e6340c
2018-01-16 10:58:52 -08:00
Željko Filipin 58e9dda85c ESLint parserOptions is reduntand when es6 env is used
Bug: T171848
Change-Id: I27ad1fc514d7420f18601990beaf1411cd6d8687
2018-01-11 14:03:09 +01:00
Željko Filipin 30511cccdc Selenium test: alerts and notices are visible after logging in
The first Selenium test in Node.js using WebdriverIO.

Bug: T171848
Change-Id: Ie6bdc0f164e24c35db8a922df57428ec4d5452d3
2018-01-05 15:16:22 +00:00
Amir Sarabadani 30a5b88ea1 Use ExtensionRegistry instead of class_exists
Bug: T183096
Change-Id: I963704cdcfdbc97727f435eb16998c16c692ed01
2017-12-29 00:12:30 +01:00
Umherirrender 08cb7a470a Change doc type from DatabaseBase to IDatabase
Change-Id: I853b7cef85fdd77c28a947a8f3601f84ba17359a
2017-12-22 23:20:13 +01:00
jenkins-bot 611fdde4d9 Merge "Remove Ruby browser tests" 2017-12-22 11:54:46 +00:00
daniel 774610c0d4 Check for IDatabase (not DatabaseBase) in tests
Change-Id: Ia94fcae2a1dd28761b4e2f40fa1491f8401ad491
2017-12-21 19:52:10 +00:00
Matthew Flaschen 47c45866de Remove Ruby browser tests
The continuous integration infrastructure for these is being removed
(or never existed), and our team decided not to invest the time to
convert them to node.js.

Bug: T171848
Change-Id: I0faeecb2635f24c40c83aa689b670e69aa381431
2017-12-20 12:29:01 +01:00
David Barratt 6593a0a427 Prevent loading or saving of zeros in the database.
When intval() fails, the function returns a zero. We should remove
the failures from the blacklist.

Bug: T178512
Change-Id: I89ad680a287da16c2fbd6aa4d53a725142429144
2017-11-17 12:34:54 -05:00
Ed Sanders 892ba8e5fe build: Update eslint and other linters
Change-Id: I68b74742bea0c3d4c8e359fd7850beaa6bbc4190
2017-10-17 13:53:08 +01:00
Roan Kattouw 98370e8c83 ContainmentSet: Use strict comparison for array_search()
Otherwise, if $list->getValues() contains the number 0,
any non-numerical string will match, because 'foo'==0 is true.

This, in combination with a broken maintenance script that had
inserted 0s into some users' blacklist, broke all notifications
for those users.

Bug: T177825
Change-Id: If8700b4d0de0fdba876eb9d5cc4997e185dfeb3c
2017-10-14 16:31:13 -07:00
Umherirrender eba147a1b4 Always return false on EchoUserNotificationGateway::markRead
Also rename some variables.
$res indicate a ResultSet, not a bool

Change-Id: I4f0276cbe01a0391b4bd2616e111067b40363fea
2017-10-06 22:22:33 +00:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
Brad Jorsch 1f9eedf40f Remove reference to deprecated IDatabase->nextSequenceValue()
The method was deprecated and made unnecessary in Ib308190c.

Change-Id: I47aca6a7c77821119f52e639d0e74a1e6302532a
2017-09-06 13:05:14 -04:00
Željko Filipin ffaf7586dd Rake test target now runs RuboCop, RSpec and Cucumber/Selenium tests.
Bug: T164479
Change-Id: I73a075f1aa8ce3d6321f5b1eeb62fe27d1d021f0
2017-09-04 16:02:48 +00:00
Kunal Mehta 9095d5bcb5 Use namespaced ScopedCallback
The non-namespaced version is deprecated since 1.28

Change-Id: Iac0b120ccda77065a480e9461e7fcbd19d55f1db
2017-08-21 14:05:11 -07:00
MusikAnimal fdd1fe6d22 Duplicate new table from core, patch 349457
With 349457, anytime a revision is created, a corresponding record
is created in the new ip_changes table. This may cause tests to fail
if they don't drop the ip_changes table between individual tests.

https://gerrit.wikimedia.org/r/#/c/349457/

Change-Id: I48f0b64f19f9582b40540fa1b42a39d281979625
2017-08-11 15:51:03 -04:00
Kunal Mehta aaf061c725 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ExtraParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I8401abf121a7413fa191d7bc535e0ddd6cf8c3f7
2017-06-22 14:13:28 +00:00
Kunal Mehta 5d2cde1022 Implement per-user notification blacklists
- Disabled by default, is a gated preference by wg variable
- User specifies blocks in Echo preferences
- Uses a TextArea with username separated by new lines as input
- Still allows notifications to come through on a user's talk page
- Cache the blacklist and whitelist

Requested at
<https://meta.wikimedia.org/wiki/2016_Community_Wishlist_Survey/Categories/Miscellaneous#Allow_users_to_restrict_who_can_send_them_notifications>.

Bug: T150419
Change-Id: Ibf548da4aa600bdc7848cba1947436e56ac48a4a
2017-05-24 16:09:04 -05:00
Brad Jorsch d7a77b0aba Fix usage of $db->nextSequenceValue()
The return value from the method is only suitable for passing to
$db->insert(). To get the inserted ID, you need to call $db->insertId()
even if $db->nextSequenceValue() returned non-null.

Bug: T164900
Change-Id: I466fd372804927b3ad72125c7a69d253bd7a24f8
2017-05-10 17:46:07 -04:00
Ed Sanders 571223a206 build: Update eslint to 0.4.0 and make pass
Change-Id: I30dd0e1ee56dbcbb7c60608a401179e2d37557ff
2017-05-04 20:57:37 +00:00
jenkins-bot a9d4fb257b Merge "Echo should notify user about mention on wikitext page" 2017-05-03 16:22:44 +00:00
jenkins-bot a3fd1af768 Merge "Echo should notify a new user with welcome message" 2017-04-26 16:11:02 +00:00
jenkins-bot 80cdc85d67 Merge "Switch TestingAccessWrapper to librarized version" 2017-04-20 19:28:11 +00:00
Gergő Tisza 39ba452b32 Switch TestingAccessWrapper to librarized version
Bug: T163434
Change-Id: Ib5aeffb793cfd84201ca397a96689e0b81f3265f
Depends-On: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 11:34:57 +00:00
Bartosz Dziewoński 0d23ba8bbe Fix browser tests
Some browser tests were broken by 945fccf009.
The badge element is now technically rendered offscreen, with only the
:before and :after pseudoelements being onscreen. Because of this, Selenium
thinks that the badges are invisible, and this breaks various things in
totally unexpected ways.

* article_page.rb: Store references to the parent <li> elements of badges.
  This might not be necessary but I don't know how to access them otherwise.
* badge_steps.rb: When clicking the badges, click the parent <li> element
  rather than the not-really-invisible <a>. Effectively, the <a> gets
  clicked anyway, since they overlap.
* no_javascript.feature/no_javascript.rb: Wait for page load before
  checking that we're on the right page. The wait is no longer
  implicit, since Selenium thinks we're clicking the <li> rather than
  <a> (links are special-cased).
* notification_steps.rb:
  * Check whether the badges exist on the page, rather than whether they
    are visible.
  * Use a weird hack to read badge text. Apparently you can't read the text
    of elements that Selenium thinks are invisible.
    http://stackoverflow.com/questions/20888592/gettext-method-of-selenium-chrome-driver-sometimes-returns-an-empty-string

Bug: T161941
Change-Id: Ic6bcd1088249109e49a47cc9007e6ee002d3d8ba
2017-04-19 22:27:02 +02:00
Elena Tonkovidova 286aeed94a Echo should notify user about mention on wikitext page
Bug: T146916
Change-Id: Id25dbc289fd3fe0fcb92bc4ec85f7851dc72026e
2017-04-18 16:53:18 +00:00
Elena Tonkovidova 69dd622894 Echo should notify a new user with welcome message
Bug: T146916
Change-Id: I5656286c91b2407a4d481531e563b41d245b5b14
2017-04-18 18:30:33 +02:00
Leszek Manicki e45705fd84 Run MWEchoThankYouEditTest on clean DB tables
Other tests (possibly from other enabled extensions) could also,
by chance, create Echo notifications for the user MWEchoThankYouEditTests
uses. In order to those tests be reliable, they should make sure
there is no notification data in the database prior to running tests.

Bug: T161087
Change-Id: I870a50b1f831795731235fa8ec97477b3e470b50
2017-03-22 16:32:49 -04:00
Ed Sanders d4d325e7e6 Use words for describing notification counts in HTML text node
The text is hidden by CSS so this will not affect regular users.

Bug: T160277
Change-Id: Iabb557a6ea2de82b488a5a40c9b5fd966270f1b0
2017-03-12 19:37:23 +00:00
WMDE-Fisch eb81a1c0f1 Avoid unintended mentions when changing content
When content is changed and the change contains the signature
of the user, the method checking for reasonable mentions in
that changes did not consider multiple signatures.

The patch fixes that and adds a test for it.

Bug: T154406
Change-Id: I86303f42e97d16c68e3235b0e2d13542ceedf1fe
2017-03-01 11:58:08 +00:00
jenkins-bot 387d0dc010 Merge "DiscussionParserTest only create users when needed" 2017-02-24 13:17:03 +00:00
WMDE-Fisch 71e3b66cc0 Remove test for internal diff engine acceptance
Since the internal diff engine is now always used this test
seems to be unnecessary.

Bug: T93625
Change-Id: I536474dc6231138293c9efc813a1bc2cc1e6f3b0
2017-02-24 11:32:37 +00:00