Commit graph

1093 commits

Author SHA1 Message Date
Umherirrender 2cd8d9d0eb Split long lines over 140 chars
This makes the code easier to read even on big screens

Change-Id: I14bfb97b2986f389ad11a6ddc97ba61468774782
2018-08-25 12:51:14 +02:00
jenkins-bot b6bfaa2e2c Merge "Explicit convert Message objects when used as string" 2018-08-25 06:17:21 +00:00
Stephane Bisson a5ececbb7e Initialize $success
Followup I85452d0f0afe974d26a575e000f6ae2ceeddf06c

* initialize "$success = true" before using it in
  a loop to keep track of the overall success of
  all batches.

* Add check for readOnly db in markUnRead() and
  markAllRead(), like it was done in markRead()

Bug: T202672
Change-Id: Ifdfa93059268d5b02ba3e0e885661ce593845791
2018-08-24 06:15:12 -04:00
jenkins-bot c419bcf45e Merge "Drop $wgNotificationSender, written to but never configurable" 2018-08-23 20:58:49 +00:00
jenkins-bot b0d83815b9 Merge "Don't send email notifs to blocked users if $wgBlockDisablesLogin is true" 2018-08-23 19:02:48 +00:00
Roan Kattouw 2b0929a4b1 Don't send email notifs to blocked users if $wgBlockDisablesLogin is true
Bug: T199993
Change-Id: I47ed3599d61ca8177cdd0820dea4089fdb087d82
2018-08-23 11:39:25 -07:00
Umherirrender 516eeda19e Remove count() of null value
php7 gives:
count(): Parameter must be an array or an object that implements
Countable
null or [] are both evaluate to false, so just remove the count

Change-Id: Id92dbd48f308d1e9dffa086699e0e944744aeeaa
2018-08-23 18:07:22 +02:00
Umherirrender a0ad95b63f Split long lines over 200 chars
This makes the code easier to read even on big screens

Change-Id: Iebc2ca785690abc6e7998c6f6078daf0bd01ccf8
2018-08-23 10:33:25 +02:00
Umherirrender e89206ce4a Explicit convert Message objects when used as string
This makes clear which escaping should be used.
In all cases it needs Message::text, because there are used inside
Html::element. There is no visual different.

Change-Id: I17474a7d5f057321e8c759d4bf94c8234c7a89c7
2018-08-21 14:16:22 +02:00
James D. Forrester eefeb6d031 Drop $wgNotificationSender, written to but never configurable
Instead just use $wgPasswordSender explicitly. This also allows us to drop the
extension registration callback function, which is a performance improvement.

Bug: T200390
Change-Id: I08d2f040c5ad8feb395a2e8e176f91636efe1d3d
2018-08-20 13:41:05 -07:00
Timo Tijhof 2142be10b0 cache: Reduce responsibility of subclass and remove unused parts
* Reduce responsibility of resolve() methods to only supplying
  the resolves values.
  Moved logic for populating the cache and clearing the queue
  to the base class, and made 'lookups' private.

* The second parameter to LocalCache::add() is unused, and never passed.
  Removed to avoid confusion.

* The getTargets() method is unused. Removed.

* The getLookups() method is unused. Removed.

* The internal 'lookups' member was being used both for its keys and its
  values, but never at the same time. This seemed risky, especially in
  EchoRevisionLocalCache::resolve() where the associative array was passed
  directly to the 'where' clause of IDatabase::select(), which shouldn't
  espect keys when creating the 'IN' clause.

  Using only values would keep value types flexible, but would require
  use of the less efficient in_array().
  Keeping both keys and values and calling array_values() would work.
  Using only keys also works and is simpler, so long only ints are used.

* The tests were swapping 'targets' MapCacheLRU with a HashBagOStuff.
  Following-up 4939bff7, this was forgotten, but works because the two
  called methods (get and set) exist in both, but still seems odd.

  Fixed by using TestingAccessWrapper to act on the existing object
  instead of swapping it out.

* Improved tests by asserting more of the observed behaviour and impact.

Change-Id: I530eeac8bf3b407b8c633e0e20c7d35cc49f7a9f
2018-08-17 03:28:02 +00:00
jenkins-bot af2b92856f Merge "Fix missing/mismatching type hints PHPDoc tags" 2018-08-16 08:39:29 +00:00
Thiemo Kreuz 2d7096bcff Fix missing/mismatching type hints PHPDoc tags
This fixes some issues I found while updating this code base, e.g.
this removes types a method really does not return.

Change-Id: I19457e7bf88945eec958bf53e0b76a7585715a45
2018-08-16 07:07:20 +00:00
jenkins-bot d53af8b8d3 Merge "Use "false" as type hint in PHPDoc tags" 2018-08-16 01:00:05 +00:00
jenkins-bot ef233becf5 Merge "Make "@… array" type hints more specific" 2018-08-16 00:57:12 +00:00
jenkins-bot cc1a3aaa6b Merge "Escape message used in html" 2018-08-16 00:16:09 +00:00
jenkins-bot b0e11b45f0 Merge "Make use of inline {@see …} tags" 2018-08-15 22:18:56 +00:00
jenkins-bot e23cf162fe Merge "Migrate EchoLocalCache to MapCacheLRU" 2018-08-15 21:45:02 +00:00
Umherirrender e499631a37 Escape message used in html
Change-Id: Iee1c2bebec8756c5672e36c837fe9c2065479673
2018-08-15 20:19:51 +00:00
Aaron Schulz 4939bff723 Migrate EchoLocalCache to MapCacheLRU
Change-Id: Ie007bc5ec1db4d9686ced724b87f9cbc328aa339
2018-08-15 12:30:51 -07:00
Thiemo Kreuz 63eee2b9a1 Remove two unused properties from AttributeManager
These two properties are protected. I used
https://codesearch.wmflabs.org/search/?q=EchoAttributeManager%5B%5ET%3A%5D
to make sure no subclass exists that might use them.

Change-Id: I37c71db55bc4832968a1812142588dddaa81724a
2018-08-15 09:29:54 +00:00
Thiemo Kreuz e5546e50b6 Add missing strict "array" type hints to DiscussionParser
This patch adds a few strict type hints on the language level, not
only on the PHPDoc level as my other patches do.

Change-Id: Ie66f9ebf80317dcaf13e2e96a93332a1a93cebbe
2018-08-15 09:03:33 +00:00
jenkins-bot 15b15adcb3 Merge "Remove $wgEchoNewMsgAlert and 'echo-show-alert' preference" 2018-08-15 01:19:38 +00:00
jenkins-bot 7d305a77d0 Merge "Use ContentLanguage service instead of global $wgContLang" 2018-08-13 23:39:27 +00:00
Fomafix f8341386a0 Replace deprecated Linker::link() with LinkRenderer
Bug: T149346
Change-Id: Icfb0a96735f8f69d73c8d597e6c7b033ca3bcf1f
2018-08-13 23:36:47 +02:00
Fomafix a1f72bbfa0 Use ContentLanguage service instead of global $wgContLang
This change requires MediaWiki 1.32 which is already required in
extension.json.

Change-Id: I61856796d864c9493c1a7a875cb2415f11f081a9
Depends-On: I193f5b9a95430b0a05573c361715e053e5411e32
2018-08-13 23:30:34 +02:00
Paladox bacee60d42 Fix "PHP Warning: count(): Parameter must be an array or an object that implements Countable"
Change-Id: I6169f4226acd41c77d0b4b7710064dce45761bbd
2018-08-13 16:37:44 +00:00
Thiemo Kreuz 8a7c3a78a9 Use "false" as type hint in PHPDoc tags
Most modern IDEs as well as documentation generators understand the
keywords "false" and "true", when a bool can only be one of the two.

Change-Id: I83dd1f0cc0802fa74ee35e7ca7425615230a767f
2018-08-13 15:31:13 +00:00
Thiemo Kreuz fc59da2cca Add missing newlines before "use" sections
Change-Id: I15b4aaac007379370f832bc24e3cebfe54dda754
2018-08-13 09:29:32 +02:00
Thiemo Kreuz c1c3c7b672 Make "@… array" type hints more specific
There are about 200 of such generic "array" type hints in this code base,
the majority in @param tags. I started with what I found most relevant:
@var and @return tags. I might continue working on this later, but
wanted to stop for now to keep this patch moderately small.

Change-Id: Iff0d9590a794ae0f885466ef6bb336b0b42a6cd3
2018-08-13 09:27:37 +02:00
Thiemo Kreuz cf4ba1e6b8 Make use of inline {@see …} tags
Tested with the quick preview (Ctrl+Q) feature in PHPStorm.

I'm also updating a few type hints I could not split off into a separate
patch, because the lines are to close to each other.

Change-Id: I312ec601a5f443c2b12515e34c574b8889c4c128
2018-08-13 09:17:15 +02:00
Kunal Mehta b0687600a2 Remove $wgEchoNewMsgAlert and 'echo-show-alert' preference
Unconditionally enable it for all users.

Bug: T58845
Change-Id: Ie3ba685cef8979fe750c449fec01992b32df0fba
2018-08-12 20:25:15 -07:00
Umherirrender dbfcd23b3b Pass correct IContextSource to HTMLForm
The special page is only a MessageLocalizer, not a IContextSource.
Its implements all methods of IContextSource, but are delegated to the
underlayed IContextSource. So pass it directly make phan happy, while
the current code works as expected

Change-Id: Ia9d83f2f71a466a2ba74540f96f165c96fb7ca00
2018-08-11 05:44:52 +00:00
jenkins-bot 96db879275 Merge "NotifUser: Remove basically-unused talk notification cache" 2018-08-10 02:05:21 +00:00
jenkins-bot 66ae28ae4c Merge "UserNotificationGateway: Use batching in markRead() and markUnread()" 2018-08-10 02:02:59 +00:00
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
Reedy 21faa050f6 Replace Revision::getText()
Bug: T147380
Change-Id: I3864fc64bd178471b1454033adbc9137485d1563
2016-10-05 00:42:45 +01:00
Roan Kattouw 9d8e09e71b Don't show pages and counts related to disabled notification types on Special:Notifications
Bug: T147138
Change-Id: I4350377720644015a1db9789979fb80cd4844745
2016-10-04 11:35:30 -07:00
enigmaeth 5b9ee79253 Dropped call to WikiPage::getText()
Bug: T146994
Change-Id: I47c5258154749b70f380c1462a4d310a04f1d85b
2016-09-29 18:47:29 +00:00
jenkins-bot e888d95f1e Merge "Used parsed section titles for anchors" 2016-09-28 14:46:47 +00:00
Roan Kattouw 6eea6d93a1 Used parsed section titles for anchors
This allows us to link to the right section when the section
title contains templates or magic words.

* Add getParsedSectionTitle()
* Use it in getTitleWithSection()
** Stop using Parser::guessSectionNameFromWikiText() because it
   wants preprocessed wikitext, not fully parsed and stripped text
* Move getTruncatedSectionTitle() from EventPresentationModel to
  PresentationModelSectionTrait and make it use getParsedSectionTitle()

Bug: T134216
Change-Id: I877ff6b0ce4e64400f6e5f6284ae47a11cd4335b
2016-09-27 16:17:59 -07:00
jenkins-bot faf3bee07c Merge "Fix links to sections with [[links]] in their title" 2016-09-27 19:53:33 +00:00
jenkins-bot 4f2ef135a7 Merge "Make user rights notifications link to added/removed group" 2016-09-27 04:00:07 +00:00
Kavitha Muthu a518044bb3 Make user rights notifications link to added/removed group
This change was made to direct users to the added/removed group.
Notification about the change in the user's right will route the user
to a page about the group.

Bug: T55860
Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
2016-09-27 03:53:53 +00:00
Roan Kattouw 229db67347 Fix links to sections with [[links]] in their title
We would generate things like #Foo_.5B.5Bbar.5D.5D
instead of #Foo_bar . Unfortunately this doesn't
fix section titles with templates / magic words
in them, because those are parsed at notification render
time instead of at notification generation time.

Bug: T134216
Change-Id: Ia171324a4a616c956ab08fcff38293f18dc765fa
2016-09-26 17:16:24 -07:00
Roan Kattouw 44a210c720 Defer cache write in EchoSeenTime::setTime()
This can be called on GET requests, like when visiting Special:Notifications,
and also from getTime() on a cache miss. Defer the write to the real
cache, but update the in-memory cache immediately.

Bug: T146492
Change-Id: I24db223ded9508942dc0ef1abf55952e98f444d0
2016-09-23 12:11:37 -07:00
Roan Kattouw 8269970305 Remove unused $flags parameter for EchoSeenTime::getTime()
It was always set to 0, and we were using the old (pre-2015)
get() interface so it wouldn't have worked anyway.

Change-Id: Ie92b223a485a5d9d256d2dc69d4ff3807e838878
Bonus: remove documentation for nonexistent parameter for setTime().
2016-09-23 11:53:59 -07:00
jenkins-bot f40f1aa36c Merge "Convert 'seenTime' to a global property" 2016-09-20 23:22:26 +00:00
Matthew Flaschen ffd9d4bb4d Fix moderation controller
The change to use DeferredUpdates had a missing use.

Change-Id: Ied72608c9b3aa597627aa5ea069c257f506c3c1b
2016-09-20 01:44:25 -04:00
jenkins-bot 21cd011dda Merge "Make sure bundledNotifications is an array" 2016-09-20 00:13:56 +00:00
Moriel Schottlender f47c554e1c Make sure bundledNotifications is an array
- Make sure that even if internal values of the array are null,
  the end-result is a valid array (with sequential keys)
- Verify that the API sent the UI an actual array, and if not,
  output an error to the console.

Bug: T145825
Change-Id: Ibdf17c58fe88e3e2547dde62cd4d3d06e089cbc8
2016-09-19 23:08:14 +00:00