Commit graph

1008 commits

Author SHA1 Message Date
Roan Kattouw 06f0a7a6d5 NotifUser: Remove basically-unused talk notification cache
This cache was only used so that, if we're told to clear the newtalk
flag and we already know there are no edit-user-talk notifications, we
won't try to delete them. But that's not a good justification for such a
confusingly-written cache that would have been hard to convert to
getWithSetCallback(), and I'm concerned that using cached data to make
this decision could lead to inconsistencies.

Also remove the notifCountHasReachedMax() check, which made no sense: if
the user has >99 notifications, that is no justification for not marking
their user talk notifications as read when they visit their user talk
page. Whether the displayed notification count will change has no
bearing on whether these notifications should be marked as read (and now
that bundled notifications are counted individually, the displayed count
actually could change).

Bug: T164860
Change-Id: I3ff5c9b31307839b9336bd8856015db9baa52fad
2018-08-09 16:34:04 -07:00
Roan Kattouw a9afcfb43a UserNotificationGateway: Use batching in markRead() and markUnread()
Change-Id: I85452d0f0afe974d26a575e000f6ae2ceeddf06c
2018-08-09 16:34:04 -07:00
jenkins-bot 8151b212ee Merge "Clean up EventLogging integration" 2018-08-09 21:54:37 +00:00
jenkins-bot 2e56ca2d4b Merge "NotificationMapper: Use batching in deleteByUserEventOffset()" 2018-08-09 18:52:07 +00:00
Kunal Mehta b574e252f8 Clean up EventLogging integration
* Move revision ids out of configuration and into MWEchoEventLogging
class. Because the EchoInteraction schema is used both server and
client, we have to duplicate the revision id.
* Use EventLoggingSchemas attribute to register client-side schema in
extension.json instead of a hook.
* Check if EventLogging is enabled in MWEchoEventLogging instead of
$wgExtensionFunctions.
* Pass only whether the EchoInteraction schema is enabled to the
client-side instead of all of $wgEchoEventLoggingSchemas.

Change-Id: I968294f96cedac19dc9d8f53df14fecfb666ceee
2018-08-09 14:19:45 +00:00
Roan Kattouw fe17b49fcd NotificationMapper: Use batching in deleteByUserEventOffset()
Also test it more meaningfully by setting up a mock database and
asserting that the right DELETE queries are issued.

Change-Id: Id39723b92118e98d9c9f0cd7381e9396dce67c17
2018-08-08 14:57:58 -07:00
Kunal Mehta 832d9d4d16 Remove $wgEchoEventLoggingSchemas qunit hack
The only place that reads the config variable is in ext.echo.logger,
which uses OO.getProp() to do so. If that property doesn't exist,
`undefined` will be returned, which we can force to boolean false.

Bug: T118488
Change-Id: Iac352b133950f6f2e4b88950c1fcd0c893284fd9
2018-07-26 19:34:42 -07:00
Kunal Mehta 2f5581c30a Move ext.echo.logger module registration to extension.json
Change-Id: Iec48ff2f2362f5861ee52fde3394a820f9cb2d07
2018-07-26 19:34:42 -07:00
Kunal Mehta 9a828c7b56 Use mw.track() to submit EventLogging data client-side
This avoids needing any dependencies on EventLogging in the module
definition, as well as allowing the extra dependencies to be lazy-loaded
as necessary.

Change-Id: I49b5be4be4f55cd4e27064247463b2ddb8e81296
2018-07-26 19:34:37 -07:00
Kunal Mehta 9f2383a727 Use UserGetDefaultOptions hook instead of $wgExtensionFunctions
$wgExtensionFunctions are run on every MediaWiki request, and should be
avoided unless necessary. Default user options should be controlled by
the UserGetDefaultOptions hook instead.

Bug: T180192
Change-Id: I2a79e078753d289c3ea2f04b613ce72c59a9e59a
2018-07-25 17:19:17 -07:00
Max Semenik f8ef0cc7f5 Get rid of special casing for user blacklist
Makes so many things simpler and robust.

Bug: T198935
Change-Id: Ia836f8f497cae8599f85cf86a7f6b299cd012e81
Depends-On: Iff63da0d215585cfcf083e7f7ec8ed45d5b77301
2018-07-09 15:50:38 -07:00
Thiemo Kreuz 75a55b80ee Remove some non-helpful lines of documentation
Explaining that a variable named "$username" contains a "username" is
not helpful. One have to read this comment first to understand that it
does not add anything to what's already obvious from the variable name
and the type.

Change-Id: I9a43866498d0c94422caf16233f502320a8e36c9
2018-07-06 15:14:44 +00:00
Stephane Bisson 10a99b016b Handle missing presentation model
When a presentation model is specified for an event type,
check if the class actually exist before trying to use it.
Logs to debug when the class is not specified or doesn't exist.

This is useful for extensions that get undeployed
(looking at you, OpenStackManager). Their notifications
cannot really render since the code to render them
is not available anymore. This make them simply go away and
the notification counts get updated shortly after because
unrenderable notifications are marked as deleted.

Bug: T195253
Change-Id: I6335204942002bba3e73887ab81e55a27b4e181a
2018-07-03 12:49:20 -04:00
jenkins-bot 65470a8d10 Merge "Add timestamps to generated notifications" 2018-06-28 13:09:29 +00:00
Moriel Schottlender 592bc476b2 Add timestamps to generated notifications
Add the ability to create notifications with specific timestamps
when generating notifications through the maintenance script.

Note, that not all notifications can be given specific timestamp;
only notifications that do not involve a direct editing action
will be given this timestamp and their events will be created
as if the actions were taken at the given timestamp, with
1 minute intervals.

Change-Id: I9e6b8660178ca0734979946c8e6ec8d43fc3de41
2018-06-27 11:16:22 -07:00
jenkins-bot 855497c3ba Merge "Avoid counting where not necessary" 2018-06-26 13:54:59 +00:00
Thiemo Kreuz cb282251a8 Avoid counting where not necessary
Change-Id: I0abbdced4474dabbdecd3bbfae194e79b7c29db1
2018-06-26 07:10:38 +00:00
jenkins-bot 1c6d589b1b Merge "Remove masterPos from the job specification." 2018-06-25 10:48:16 +00:00
Moriel Schottlender 94f17f7910 Always place items outside menu if there's less than two of them
Bug: T174927
Change-Id: I5a30cf4d5cdc3e7ea9ea7b0536e015de8825f785
2018-06-22 15:31:05 +00:00
Petr Pchelko bf2cc7e687 Remove masterPos from the job specification.
The `DBMasterPos` class is not JSON-serializable, so
we can not transfer the job in the kafka-based queue.
Before, we were waiting for slaves before executing the
job till the point in time when the job was submitted,
now we will just wait for slaves till the point in time
the job was executed. That lets up not to include the
database master position in the event and make it serializable.

Bug: T192945
Change-Id: I7c754bd1e899bad030cc6434be19daf2542e015f
2018-06-18 19:56:15 +03:00
jenkins-bot 61cfa13beb Merge "Update some PHPDoc tags for improved type safety" 2018-06-18 01:14:37 +00:00
jenkins-bot afec5a19ec Merge "Directly use Language::factory instead of wfGetLangObj" 2018-06-18 01:14:35 +00:00
Thiemo Kreuz 6aa6824f96 Update some PHPDoc tags for improved type safety
Change-Id: I7573ab01e88c86c25180bc56b3874505aa00a047
2018-06-17 19:04:54 +02:00
C. Scott Ananian 190377dbbc Replace uses of deprecated Language::truncate()
See I2291c69d9df17c1a9e4ab1b7d4cbc73bc51d3ebb for the anticipated
hard-deprecation of this method in core.

Bug: T197492
Change-Id: I4687db09c27480147cfa7a648a886b1670812deb
2018-06-16 09:30:06 -04:00
Max Semenik 0a09984f55 Get rid of call_user_func_array()
Yay PHP7!

Change-Id: I3bad8d1a5a65137d9617ccd39c65b8a97edbf01a
2018-06-08 01:03:46 -07:00
Fomafix 99173922c1 Directly use Language::factory instead of wfGetLangObj
Other places like Message::inLanguage also use
Language::factory( $user->getOption( 'language' ) ).

Change-Id: I911dc2319e1922276daa3eb3614a350c80b8b57f
2018-06-05 11:00:14 +02:00
Roan Kattouw d0714b2928 NotifUser: Simplify function signatures for getNotificationCount() and friends
The $cached and $dbSource parameters are now unused, so remove them.
This affects get{Notification,Alert,Message}Count and
getLastUnread{Notification,Alert,Message}Time.

There are some callers in other extensions and in skins, but none of
them pass any parameters (except one, which I fixed in Ice42930280da).

Change-Id: If6f10c4f163ecb1def5a150656a60d1ab5f44d52
2018-06-05 01:07:23 +00:00
jenkins-bot aa984f1b9b Merge "NotifUser: Add a doc comment for getForeignCount()" 2018-06-02 17:20:28 +00:00
jenkins-bot 205c937164 Merge "NotifUser: Simplify timestamp comparisons in getForeignTimestamp() too" 2018-06-02 17:14:01 +00:00
jenkins-bot ffa6922558 Merge "NotifUser: Remove $dbSource parameter from resetNotificationCount()" 2018-06-02 17:11:34 +00:00
jenkins-bot 533a58dfcc Merge "NotifUser: Un-merge getMemcKey() and getGlobalMemcKey()" 2018-06-02 17:11:33 +00:00
jenkins-bot bb453d23e3 Merge "NotifUser: Redo caching strategy for multi-DC compatibility" 2018-06-02 17:10:20 +00:00
Roan Kattouw fa21b7b0cd NotifUser: Un-merge getMemcKey() and getGlobalMemcKey()
We used to have code that called getMemcKey() with a boolean parameter
deciding whether to get a local or global key, but we don't do that
anymore: every code path now knows whether it needs a local or global
key. Consequently, move the code for global cache key generation back to
getGlobalMemcKey(), rather than having both be in getMemcKey() and
getGlobalMemcKey() being a wrapper.

Change-Id: If35bafc53e1e0086c31fd9675a9dc057e36f5717
2018-05-31 16:01:57 -07:00
Roan Kattouw 1fec0793e1 NotifUser: Remove $dbSource parameter from resetNotificationCount()
As Krinkle points out, it always writes to DB_MASTER, so it doesn't make
much sense to offer an option to read from DB_REPLICA. This also
resolves the race condition that I believe arises from the one caller
that passes in DB_REPLICA.

Change-Id: I6976e5479debc3f4a8f28d53b1616c01475772be
2018-05-31 00:53:06 +00:00
Roan Kattouw 0edd96da17 NotifUser: Add a doc comment for getForeignCount()
Change-Id: I47fc2d879b6292d70ba53f8a52f450eed83cfcb6
2018-05-31 00:52:59 +00:00
Roan Kattouw 5935a63731 NotifUser: Simplify timestamp comparisons in getForeignTimestamp() too
Change-Id: I89e75eeded95f7417f8fccfa6274fa19ff5a26c7
2018-05-31 00:52:52 +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
jenkins-bot bb3cb12262 Merge "CachedList: Use getWithSetCallback()" 2018-05-30 21:55:07 +00:00
jenkins-bot 0aef7d8d94 Merge "NotifUser: Make resetNotificationCount() default to DB_MASTER" 2018-05-30 21:55:06 +00:00
jenkins-bot 8eba5bba4e Merge "build: Updating mediawiki/mediawiki-codesniffer to 20.0.0" 2018-05-30 15:24:34 +00:00
Roan Kattouw 5c33f929bf CachedList: Use getWithSetCallback()
Bug: T164860
Change-Id: I0d89865fadcbc7f014e2d88a9a984228d44bc1c6
2018-05-30 05:15:20 +00:00
Roan Kattouw 32b82fa1fe NotifUser: Make resetNotificationCount() default to DB_MASTER
We almost always call it with DB_MASTER, and I'm pretty sure that the
one call that uses DB_REPLICA introduces a race condition. I didn't want
to change that quite yet, though, so I left it in for now.

Change-Id: Ia5a59fdda357b799e327b8ed224f3ccb09509a8a
2018-05-30 05:14:38 +00:00
Roan Kattouw 544129492d UnreadWikis: Check the actual object we're about to call a method on
In principle, if $alertCount > 0, $alertTime should never be null,
but it feels much safer to check $alertTime itself instead.

Change-Id: Ifb107e257fbcd65e8181e2a214028f1b3733ac30
2018-05-30 05:03:51 +00:00
Roan Kattouw e29d1253b3 UserNotificationGateway: Add getDB() method
So that classes that get a UserNotificationGateway dependency-injected
into them can get something to call Database::getCacheSetOptions() on.

Change-Id: Ie1c98f09d1581ea17809a4dfc68adec1e2805580
2018-05-30 05:02:17 +00:00
Roan Kattouw 0483c5ff67 EchoHooks: Fix copypasta in link to documentation page
Change-Id: Ic39468363a7c44d69f01d76ed6500104610b5ee0
2018-05-30 04:17:57 +00:00
Fomafix e20d0aaf4d EventPresentationModel:🏭 Force type Language for $language
The call of wfGetLangObj() is not necessary anymore.

Depends-On: I36834dbd119f4299f84b3dfe5e085eb0f6b8499c
Change-Id: I4e047393eee337432dd5edd0b4e3d650b6c7d393
2018-05-28 08:00:06 +02:00
libraryupgrader d1ef3a9514 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I69d6907eadd607cbeaef63d813ef79aea4e7983c
2018-05-26 02:15:41 +00:00
Stephane Bisson 4690c2fb47 Use static newFromID instead of loadFromID
Bug: T192945
Change-Id: Ifd7c40dfef5147581a59d39a6dbe7312a9b82cc6
2018-05-17 22:29:09 +02:00
Stephane Bisson be88fc58c1 Make NotificationJob json-serializable
NotificationJob used to include an instance
of EchoEvent, which is not serializable.

With this change, it only includes the
event Id (int) and retrieve the event
instance in its run() function.

Bug: T192945
Change-Id: I00950ddfa37717c7dfc19efdca9701693622da5d
2018-05-08 15:52:55 -04:00
Kunal Mehta e33b42882d Move EchoHooks into includes/
Change-Id: I6fe78ca2763f1d449198d9f4e9a0c4d9b8e081f7
2018-04-09 00:24:23 -07:00
Umherirrender b166664efc Fix parameter docs
Change @param to @var
Add |null to nullable arguments
Removed comment out code

Change-Id: I535ad4d544284c1e0fb6f39c254761f0810b4cc7
2018-04-06 08:17:17 +00:00
Umherirrender 7e40fcc6ca Add missing use for namespace Wikimedia\Rdbms
Changed to interface, because the result of IDatabase::select is
directly returned and now the same type

Change-Id: Ib77e1f5c26ebf0b474dc944b15d6ef671a88e836
2018-04-06 07:56:13 +00:00
Umherirrender 52e91a605a Fix return type of EmailBatch::newFromUserId
Use | as separator for multiple classes

Change-Id: I246443b058436bec6b17675d4be46e130a4c075b
2018-04-04 12:35:54 +00:00
Max Semenik 6229cadd2e Revert my fix for summary pings in reverts
To redo more properly.

This reverts commit 74eacad8d6.

Bug: T190374
Change-Id: If178ed1a497df5276894f86d7a3312811651ce6b
2018-03-26 15:37:10 -07:00
Ed Sanders 34e3d5feba Replace double-check with checkAll from OOUI
checkAll was specifically designed as a
replacement for double-check.

Change-Id: Ibdd6865213107650b9004ab40e12c6a7453b6251
2018-03-22 21:23:33 +00:00
Max Semenik 74eacad8d6 Properly handle undos/reverts and links in them
Bug: T189819
Change-Id: I6957157c02557f88e7a951667bd13dbb66c82193
Depends-On: Ib1dc0c323a9a5083b462421c68575fc22ad4af35
2018-03-16 16:20:39 -07:00
Brad Jorsch 48d737471e Update for the actor table change
Core change I8d825eb0 begins the process of changing core database
tables from using xx_user and xx_user_text fields to using xx_actor.
This updates the extension to continue to function during and after the
transition.

Bug: T167246
Change-Id: I5c0c4879c5ab252be9c0582aa9efa871304a8ad8
2018-03-12 14:34:45 -04:00
Umherirrender 748d9888d5 Fix typo in word compatibility
Change-Id: I499ebc795837a59f4c3f77dfc7e2e7ab60ae4fd6
2018-03-09 22:22:55 +01: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
Max Semenik 63b831f376 Disable pings from summary for bots
Bug: T189040
Change-Id: Ie99ad42fd1f5c6d1618669ae395e72e656b97135
2018-03-06 18:27:17 -08: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
jenkins-bot e0d634689d Merge "Add various read-only mode checks" 2018-02-22 20:33:05 +00:00
Aaron Schulz 06b6aee301 Add various read-only mode checks
* Make updateCount() check isReadOnly()
* Make EchoUserNotificationGateway::markRead() check isReadOnly()
* Make ApiEchoMarkRead check if the echo DB is read-only
* Remove access getExternalLB() argument

Bug: T187942
Change-Id: Ibafce8839b46e28251a6c1c08dd61fec4756bf33
2018-02-22 08:07:19 -08:00
libraryupgrader 83bdf90eb5 build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.MissingCovers.MissingCovers

Change-Id: I2a48e5c27a7307b3982d11875180fc11f2a125d9
2018-02-15 09:51:55 +00:00
Umherirrender dc7d27a795 Split assignment and return statement
Doing it in two lines makes it easier to read
This makes also clear that this is not a broken condition

Change-Id: I9771b6457789b7dc572f2d73d1fae8c361f9a1e6
2018-02-06 22:52:47 +00:00
Kunal Mehta 0209f4eb2f Don't use deprecated SpecialPage::getTitle()
Change-Id: I20c7d058bb25207705c08fe293800a6d1e0aab0e
2018-02-04 18:53:08 +00:00
Phantom42 254cf8360b Fix multiple PHP class declarations in one file
All files containing more than one PHP class were split into
multiple files.

extension.json was updated to match new class locations.

Bug: T177809
Change-Id: I4e7d8f02164c3048c41c4c9fbe4be18a99e7abaa
2018-01-21 21:17:53 +00:00
Stephane Bisson ca27299f51 Format user-rights reason as plain text
Format user-rights reason as plain text
in both web and email since links
in notification body are not supported.

Bug: T172636
Change-Id: Ief5ff0aff18aad070f4388e075b5aae072d8f101
2018-01-09 08:41:21 -05:00
jenkins-bot 290e5f6348 Merge "PresentationModelSectionTrait: Use section anchor generation from code" 2018-01-04 16:59:59 +00:00
Umherirrender 08cb7a470a Change doc type from DatabaseBase to IDatabase
Change-Id: I853b7cef85fdd77c28a947a8f3601f84ba17359a
2017-12-22 23:20:13 +01:00
Thiemo Mättig 2e9a27558c Minor cleanups to PHPDoc blocks
Change-Id: I5890144521b6b54c798b1590ab8d102d74ada26a
2017-12-15 15:42:38 +01:00
Brad Jorsch d049fc8802 Use ParserOutput stateless transforms
See MediaWiki core change Ied5fe1a61. There's no need for a dependency
here, though, since it'll just ignore the extra parameter.

Change-Id: Iff28b00638c15de7307a130196bbb91cda91c3d1
2017-11-24 12:20:40 -05:00
Roan Kattouw babd3f76d3 PresentationModelSectionTrait: Use section anchor generation from code
We used to have to DIY it because the core method stripped links, but
with guessSectionNameFromStrippedText() this is no longer an issue.

This allows us to pick up the nbsp handling that was added to core in
129067c907.

Bug: T180689
Depends-On: I56b9dda805a51517549c5ed709f4bd747ca04577
Change-Id: I192218dd14464de5041ceb1c16125bbcd8f44f18
2017-11-22 18:17:37 -05:00
jenkins-bot c02e732f06 Merge "Prevent loading or saving of zeros in the database." 2017-11-17 21:29:22 +00: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
Fomafix 37ef8819de Use getHtmlCode() instead of getCode() for HTML attribute lang
The HTML attribute lang uses a BCP 47 conform language code.

Change-Id: I16c7521bb08062337d5eb1502d9e7d96c1b0cc48
2017-11-09 11:45:22 +01:00
WMDE-Fisch 4cb11b84ef Fix some doc blocks
Change-Id: Ieb55488792a4609e497a81687c04f4beb3b92b86
2017-11-07 17:06:17 +01:00
jenkins-bot 0c5694802b Merge "Update for deprecation of selectFields() methods" 2017-10-30 23:20:37 +00:00
Matěj Suchánek b7f189ca5a Make edit-user-talk notifications expandable
Bug: T162299
Change-Id: I79a5e52dc8b861bd0ed4a55ce5d80c5a97cddb70
2017-10-20 11:27:47 +02:00
Max Semenik 7568dae7b0 Get rid of double-escaping
Title fragment isn't supposed to be escaped on input. It gets escaped later,
when getFullURL() gets called on the title. This previously didn't matter much
because Sanitizer::escapeId() doesn't break anything if called repeatedly. However,
now it's deprecated anyway and uses legacy encoding so I need to get rid of it.

Change-Id: I6392604ac0841ae92a21ecb569c9643d7bc6231c
2017-10-18 18:52:21 -07:00
Umherirrender 546e3bdd55 Improve some parameter docs
Change DB_SLAVE in comments

Change-Id: Idd5787928b87f5af63864dc626cb603f281515d7
2017-10-18 18:44:52 +02:00
jenkins-bot 6338d229c7 Merge "Minor PHPdoc fixes" 2017-10-17 20:06:32 +00: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
WMDE-Fisch 713c28e861 Minor PHPdoc fixes
Change-Id: I037df8d0bd13dd7a8201fd1408bb2f642f9786b6
2017-10-13 13:48:05 +02:00
Brad Jorsch 93136b71ac Update for deprecation of selectFields() methods
Various selectFields() methods were deprecated in MediaWiki core change
Idcfd1556, replaced with getQueryInfo() methods.

Change-Id: I5d62ad76fdb64a9c6efd228f27e9b5f512f17d5e
Depends-On: Idcfd15568489d9f03a7ba4460e96610d33bc4089
2017-10-12 16:04:15 -04: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
Chad Horohoe 382d163f95 Remove unstub logic
User objects haven't been stubbed in awhile, and language objects
aren't being stubbed anymore.

While we're here, swap a few MWException -> InvalidArgumentException
since they're more accurate :)

Change-Id: I7e2f2aa135b024fb653c3ec13181d7015383ff2f
2017-10-03 23:15:51 +00:00
David Barratt 3ba76f7faa Use User Ids instead of User Names for Echo Mute
The echo mute list uses user names which are not stable. User ids should be used instead.

Bug: T173475
Change-Id: I947bcf37a8f85aaa105776d368dbd0ab76823aeb
2017-10-02 19:39:40 -04:00
jenkins-bot 746b965fb2 Merge "Fix PHPDoc Documentation" 2017-10-02 22:53:47 +00:00
David Barratt d76ff6e32f Fix PHPDoc Documentation
Documentation is throwing linter errors and needs to be fixed.

Bug: T173475
Change-Id: Ic120b6a7a1f29ea90a939c4348202c09d47c38f5
2017-10-02 18:40:46 -04:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
Mark A. Hershberger 36ffa115c7
Provide base href in Echo's HTML emails
While working on my own Echo notifications for CategoryWatch, I came
across this bug.  I was happy to see that someone else identified this
a while back.

Wikitext-to-html production for the body of Echo messages does
not fully qualify urls.  This means that links are created pointing
to, for example, "/w/index.php..." instead of
"http://example.com/w/index.php...".  Supplying a base URL in the html
for the message fixes this problem.

Bug: T141521
Change-Id: Icfb9f3be58b83d2a441972adb58fef1169169d7c
2017-09-19 22:15:56 -04: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
libraryupgrader 638633216a build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
The following sniffs are failing and were disabled:
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.ClassMatchesFilename.WrongCase
* MediaWiki.Files.OneClassPerFile.MultipleFound

Change-Id: I7cbf305fae765dbf68df07f84992c2d5ed5486c6
2017-09-01 04:48:56 +00:00
jenkins-bot e74713a3ba Merge "Add 'Mark all as read' button" 2017-08-13 16:19:56 +00:00
mdew192837 e88185c54e Add 'Mark all as read' button
Currently, the 'Mark all as read' button exists only for JS users.
This patch adds the button for no-JS users as well.

Bug: T96061
Change-Id: I1a62c56306597209540ffd694c8fb7b2a92885c9
2017-08-13 10:55:46 -05:00
Kunal Mehta 27fa8c4f7d build: Updating mediawiki/mediawiki-codesniffer to 0.11.0
Change-Id: I48f0b64f19f9582b40540fa1b42a39d281979624
2017-08-10 23:22:40 -04:00
Umherirrender 5b4730c9bc Improve some parameter docs
Change-Id: Ie71fb080926781f2905e6264be060203c56185ea
2017-08-09 17:21:10 +02:00
jenkins-bot 41d160692b Merge "Check canHaveTalkPage() before calling getTalkPage()" 2017-08-02 17:07:12 +00:00
Roan Kattouw 5039841581 Check canHaveTalkPage() before calling getTalkPage()
Bug: T172146
Change-Id: I13e9d040e215b04de7843767706f6799a7787524
2017-08-02 00:47:18 +00:00
Umherirrender 79b6f470af build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: I2326cf81e907f2a02615f96f922b66fd2806defd
2017-07-26 21:34:44 +02:00
Ela 07cac5c9f7 New Article Reminder API
This will be used to submit a new article reminder, for a specified date.
The delay is not implemented yet.

Bug: T166973
Bug: T167450
Change-Id: I773bbe98e781957912350c481c850b3263cb1821
2017-07-19 11:07:22 +00:00
Roan Kattouw abff3f780d Replace EchoDiscussionParser::htmlToText with Sanitizer::stripAllTags()
The latter doesn't trim(), so add trim() calls in some cases.
User input is trimmed, parsed i18n messages are not.

Change-Id: I933a6a929bf7d3e2d1623ea537227dc8c731cb6f
2017-07-07 16:55:51 -07:00
Ela a4974ef1e1 Adding the first step in order to enable the visualization of the Article Reminder feature.
Includes feature flag, presentation model.
Temporarly hooks to new user creation.

Bug: T165755
Bug: T165754
Change-Id: Ic0a2ca07b0cd1597e5534bb1f3b748beb215ddfc
2017-06-30 19:45:24 +03:00
Kunal Mehta 95f83de225 phpcs: Fix "MediaWiki.Commenting.FunctionComment.WrongStyle" issues
Change-Id: Ieb1d52e6fd4e1de54e6f1bbfde849acd54fbe0dc
2017-06-22 14:14:28 +00: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
Matthew Flaschen 24a055c946 Correct license to MIT
This extension overall is under MIT, per Echo.php, extension.json,
and COPYING.

Change-Id: I39d533b671bb9eff3ba2e9faf5fcf482374b8e61
2017-06-20 20:32:39 -04:00
Matthew Flaschen 813ab5b54e Fix user talk exception for blacklist
There was a null-dereference for events without titles.

Also, it should only whitelist their own user talk space, not e.g.
mentions on someone else's user talk space.

Bug: T150419
Bug: T166627
Change-Id: If7d9cad4eb33ce1f1e6b7d86244332ad5dece954
2017-05-30 19:42:20 -04: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
Matthew Flaschen 6a38987198 Trivial docfix in DiscussionParser
Change-Id: I105b297333017dbce71cc42528a0e76f8be5da4b
2017-05-20 13:09:06 +02: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
Max Semenik 5003262d77 Don't use deprecated class
Change-Id: I76ad6b8cafb4fcf2f1f2ce32537a5314a66b64a0
2017-05-05 11:51:04 -07:00
Roan Kattouw 2e4e14498a EventMapper: Don't retry failed lookup queries on the master on GET
Only retry lookups if there are multiple DB servers and
changes were made in this request. This same logic is used
in a couple of places in MW core, like WikiPage::loadPageData()
and Revision::newFromConds().

Bug: T164505
Change-Id: If1af363f9687019864b5eaef72ffe0bc824a2223
2017-05-04 17:49:33 -07:00
jenkins-bot f19d9156a2 Merge "Fix counting of bundled mention notifications" 2017-05-03 10:53:54 +00:00
WMDE-Fisch 620855d770 Fix counting of bundled mention notifications
This patch will fix the notification counts in bundled mention notification
messages. The former method did not work at all due to false assumptions
what the getBundleCount method can be used for.

Since this is in the presentation only wrong messages should be fixed when
deployed

Bug: T164115
Change-Id: If316549a090c2d281a8d612e4985fd556eabc807
2017-05-03 10:40:40 +02:00
jenkins-bot 71e10ff246 Merge "MentionStatus: prefer failure-type" 2017-04-20 20:26:23 +00:00
Stephane Bisson dd77a46c1b MentionStatus: prefer failure-type
In MentionStatusPresentationModel, prefer
extra['failure-type'] to event-type to determine
why the mention was not sent.

Bug: T144614
Change-Id: Id3b55e15a0c1a8f3fee19cbe07983c6e373b309e
2017-04-20 12:21:02 -04:00
Stephane Bisson c46d56b018 Special:Notifications show unread by default if there's unread notifications
Bug: T162927
Change-Id: Ibdfaca90803eb8b12b12eb1781b0692e7336b7d9
2017-04-19 15:20:12 -04:00
This, that and the other 3f99672d5e Add proper message when user group expiry is changed
There's a lot more that could be done to improve user "rights"
notifications (really user group notifications), but this will do for now.

Bug: T159301
Depends-On: I5d32445f8e5b41599889b8488a2431e7a908f858
Change-Id: I27d52bc5c39219c832bf63a491faa1e421b0c024
2017-04-10 11:38:49 -07:00
Chad Horohoe f4a5ad9300 LoggerFactory is now namespaced, reference it properly
Bug: T161837
Change-Id: Ide941dc019163ed09f208caa7a615d1e3483bc91
2017-03-30 12:35:47 -07:00
Paladox ecae781538 Fix Illegal string offset 'ltr' in ResourceLoaderEchoImageModule.php
Make $paths an array.

@Krinkle came up with this fix. I just uploaded the patch.

Bug: T161420
Change-Id: I709808bfb0e620f7808175dc272fd57e88b663f5
2017-03-27 23:46:45 +00:00
MtDu 185e68a803 Support loading of secondary icons in RLEIM module
Before, secondary icons, such as linked, changes, thanks, and
userSpeechBubble were loaded in mw.echo.ui.icons.less. Now, an
extra icons attribute is passed when the module is loaded, allowing
RLEIM to know which icons to load. If this attribute is left out,
an MWException will be thrown.

Bug: T159394
Change-Id: I9b36a74bcf1da0d1c698845bd067b226fb81ac96
2017-03-01 23:45:04 -06:00
Roan Kattouw e0ecaad90e Log more info for unserialize failures, and don't treat them as errors
Bug: T159372
Change-Id: I1110465759bd831a9a324bf3f11a3add4f5f446b
2017-03-01 13:02:59 -08: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
Umherirrender 3a72d87838 Remove unused DiscussionParser::stripIndents
Change-Id: I75fbcae70655c6db2873fd5e22d11a3c2cbf2f84
2017-02-22 18:05:07 +01:00
WMDE-Fisch d6f011aa1a Fix mentions failing editing empty pages
For the used diff engines an empty/new page is equivalent
to an empty line. When adding content that includes an
empty line the content will be split into two parts. The
interpreted diff will then consist of one addition, one
copied line and another addition.

Is the ping in the first addition and the signature in the
second addition the DiscussionParser does not send mentions.

The patch introduces a special case when interpreting diffs
if content is added to empty content. This will also skip
execution off diff engines since the interpretation is trivial.

Bug: T155998
Change-Id: Id5e44bc3245940c1f77c80f036db637756542552
2017-02-10 14:39:13 +00:00
jenkins-bot d3fb6d38ea Merge "Use internal diff engine" 2017-02-10 11:24:28 +00:00
WMDE-Fisch 9b0a6f7a47 Replace deprecated wfGetLBFactory() and wfGetLB() call
Change-Id: I500196084db57e9d74dc25a513cbebea9ae3c9a6
2017-02-09 17:43:40 +01:00
WMDE-Fisch a1cb603bb3 Use internal diff engine
wfDiff() is deprecated and using the internal diff engine is
recommended as replacement.

Bug: T93625
Change-Id: I60af08888ef4e0bc9b80b75495f6e9e3fa631002
2017-02-03 19:07:21 +00:00
Leszek Manicki c205cd85d3 Document return value EchoEventPresentationModel:getTruncatedX methods
Change-Id: Ic3416bc07bb2f47ff6800ab0de86ee7b23a7cc2e
2017-01-30 11:54:55 +01:00
Stephane Bisson 8524471820 Remove 'text' as a valid notifications output format
The ability to format notifications as text
has been removed in Ic5712c4ce265b6faabce7a4028b4294fe3c73f18.

Bug: T155874
Change-Id: I72cadbaaa01414ce46315a618da0cb46241ad93e
2017-01-25 10:33:44 -05:00
Reedy 569006f614 Pass 2 parameters to addDeprecation
Change-Id: I891f94d32d64296fdb121d632e94dfba4b09070f
2017-01-05 22:14:38 +00:00
Yuriy Shnitkovskiy a3784bef1d Fixed variable interpolation in DataOutputFormatter.php
Bug: T154369
Change-Id: Ib51165081797d3aa5e036e3fde771ac92e89baa3
2017-01-03 09:55:29 +02:00
Justin Du 67f926707e Add GENDER support to a few Echo messages
* echo-email-plain-footer
* echo-email-html-footer-preference-link-text
* echo-email-html-footer-with-link

Bug: T145439
Change-Id: I2d55a617910efa11effef1a469e6d845eebc5591
2016-12-28 10:43:40 -06:00
Thiemo Mättig a37742b422 Fix typos and incomplete PHPDoc tags
Change-Id: I29382492a7afd14440019c0c478f5a81c2254f59
2016-12-28 12:57:26 +01:00
Stephane Bisson 61b602e961 Fix unread notification count caching
Purge all cache when unread count changes and
repopulate on read.

Also fix client-side estimation when
marking a foreign notification as read.

Bug: T151389
Change-Id: I62def3d40a5640e26c234bb0335bc506dbf864a0
2016-12-09 09:23:59 -05:00
jenkins-bot 312bec325c Merge "Update for API error i18n" 2016-12-06 20:03:32 +00:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
Roan Kattouw 49974544ba Split up $wgEchoConfig
$wgEchoConfig is a deeply nested structure that ExtensionRegistry can't handle well.
It also combined different things, and the version number was used for two
separate purposes.

Split this out into $wgEchoCacheVersion, $wgEchoEventLoggingVersion
and $wgEchoEventLoggingSchemas.

Change-Id: I2f9d5d111f7925fb057d423a3e7064bff5040205
2016-12-05 15:44:12 -08:00
jenkins-bot 9733505d1c Merge "Align Email format with Wikimedia color palette" 2016-11-28 16:11:21 +00:00
Amir Sarabadani 047b92e4c6 Align Email format with Wikimedia color palette
For Wikimedia color palette see: https://phabricator.wikimedia.org/M82

Change-Id: I6782148e94f4896397f93295ab44760c02556e25
2016-11-28 00:50:46 +03:30
Roan Kattouw ed613f2e26 Fix missing doublecheck icon on Special:Notifications on mobile
Bug: T146706
Change-Id: I918beabb1bcbe4a66c4252a795d379e2ff6591a9
2016-11-23 16:31:23 -08:00
Brad Jorsch f608d73287 Update for API error i18n
See Iae0e2ce3. Since Echo master requires core master, this just depends
on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: Icc088b31bc99e03ac88dfb44329df55318bf99b5
2016-11-14 12:48:24 -05:00
WMDE-Fisch 5d0a03fcf1 Fix typo in doc
Change-Id: I8a4c3119391ef436cb021b8512ccd3a2dce185f4
2016-11-01 15:08:29 +01:00
Aaron Schulz cfa0aa099a Fix bogus variable usage
Change-Id: I9100648d5b6be63a697a8660def33e592d010688
2016-10-17 19:53:10 -07:00
Kavitha Muthu d3d61409d3 Show orange alert and provide hook
Show orange alert for all notification types in the edit-user-talk
category and provide a hook to enable other extensions to prevent
the orange alert from appearing.

Bug: T137954
Change-Id: I0b49c3a5eb0a027f8839ab86e77c527357907dd0
2016-10-14 17:54:29 +00:00
Reedy 161f21ab5a Database and LoadBalancer documentation updates
Replace deprecated function calls

Change-Id: Id7e4136d7258abb61117fff73d51766954605737
2016-10-09 21:21:33 +01:00
addshore 4010faaf89 Add some typehints & phpdoc
Change-Id: Ic5751f0745685ea4db009458b5976907dc22c518
2016-10-05 23:27:02 +01:00