Commit graph

3756 commits

Author SHA1 Message Date
Moriel Schottlender e9264022a7 (re)Add JavaScript hooks to Notifications
Added the following Javascript hooks:
* ext.echo.notifications.beforeRender: Firing before a group of
  notification widgets are rendered, whether in the popup, in
  the special page, or in a cross-wiki bundle (which requires
  async loading)
* ext.echo.badge.countChange: Fired when the badge count changes
  with the notification type, count and the label count for
  display purposes.
* ext.echo.popup.onInitialize: Fired when the popup is opened and
  after notifications were fetched, with the context of the popup
  notification type.
* ext.echo.special.onInitialize: Fired when the special page is
  ready and notifications were fetched. Note that it will be fired
  whenever the special page is updated with notifications list,
  as well, like when changing filter, remote wiki or pagination.

The hooks were also documented in hooks.txt

Bug: T146296
Change-Id: Ie3dc97f97e8d1f90b67f62fcdc65dd29cb379aad
2016-10-14 17:25:25 -05:00
Translation updater bot 54d62d6938 Localisation updates from https://translatewiki.net.
Change-Id: I27b2db1267bc0873a747dd9ee4b4e8e21dff1786
2016-09-23 22:32:52 +02: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
Translation updater bot f53d924503 Localisation updates from https://translatewiki.net.
Change-Id: Ia73ddb94c85bec88b310fbeef3e309aecb81be1b
2016-09-22 23:37:13 +02:00
Timo Tijhof 12eff85cf7 jsduck: Remove custom @source tag
Only used in external.js to render a simple link. These methods
don't have a regular description and as such the link renders
effectively the same way in the same place without `@source`.

Change-Id: I83cd524b6b53e67c5c2d18258c804ebd49a29b74
2016-09-21 00:51:46 +01:00
jenkins-bot f40f1aa36c Merge "Convert 'seenTime' to a global property" 2016-09-20 23:22:26 +00:00
Translation updater bot 0e1a70da64 Localisation updates from https://translatewiki.net.
Change-Id: I06a1596e5105d67f3cbcdfcab5b116422d5a440c
2016-09-20 22:38:11 +02: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
jenkins-bot 92c7c8d521 Merge "Remove primary link from the bundle of page linked notification" 2016-09-19 22:59:15 +00:00
Moriel Schottlender 1575e2bb7a Convert 'seenTime' to a global property
This transforms seenTime concept to a global property for all wikis
and sources, and updates the global seen time on opening the popup.

Bug: T134855
Change-Id: I67bcc4b346237317c7a9204dd43cd0e9ee02792f
2016-09-19 14:37:31 -07:00
Moriel Schottlender 58c53af1d1 Remove primary link from the bundle of page linked notification
Also, make sure that the bundle follows the same behavior as the
xwiki bundle, where if it does not have a primary link, the 'click'
event triggers the 'expand' action.

Bug: T145902
Change-Id: I456bf76a7bd531ffcad5462708f37cd54d8af99d
2016-09-19 14:16:43 -07:00
Translation updater bot 58f9a5b83c Localisation updates from https://translatewiki.net.
Change-Id: Ie35a5014d44151e77a1e55f5455cadc5b4a178d7
2016-09-19 22:54:03 +02:00
jenkins-bot bac8d67e99 Merge "Count the number of success & failure notifs sent" 2016-09-19 08:14:32 +00:00
jenkins-bot 8cffb4ec5f Merge "Update the badges' seen state when Special:Notifications is visited" 2016-09-19 05:09:13 +00:00
Translation updater bot 470f53ee80 Localisation updates from https://translatewiki.net.
Change-Id: Iefdb34dfb80f694ca72873c0ec24b6f1cf6dbc0e
2016-09-17 23:18:13 +02:00
Moriel Schottlender 3cb4663668 Update the badges' seen state when Special:Notifications is visited
When the special page is loaded, all notifications should be marked
as seen for both the no-js and JS versions.

Bug: T134855
Change-Id: I053ce07ca26a858fd42c9d070b7dce73cc161e4b
2016-09-15 14:19:35 -07:00
Translation updater bot bc4ad9677e Localisation updates from https://translatewiki.net.
Change-Id: I08ce1d2c272e2aeb5e485efc8b106db8ab1ba903
2016-09-15 22:59:18 +02:00
jenkins-bot dafc7f6541 Merge "Fix GENDER without explicit parameter" 2016-09-14 20:51:33 +00:00
Matthew Flaschen f2327a919b Fix GENDER without explicit parameter
Although we generally use getViewingUserForGender, these messages
are UI and in user language, so we should change the flag anyway.

getViewingUserForGender is essential for messages that are used
in batch jobs.  Some messages technically don't require it, though
it's probably best to be consistent anyway.

Bug: T144538
Change-Id: I7b57777ab93b5752165c7bdd85fa5ce66b294b22
2016-09-14 16:39:49 -04:00
Translation updater bot 7081917919 Localisation updates from https://translatewiki.net.
Change-Id: I534b65fcf07281543ed09bfd825a6c7715a4c7cc
2016-09-14 22:34:41 +02:00
addshore cb575928a9 Count the number of success & failure notifs sent
Change-Id: I3e11bc8878ddf48265c628d828ee700f3aee7bbb
2016-09-14 13:35:03 +02:00
Jakob Warkotsch 3da89ea4d9 Send notification for mentions on changes
This sends out a notification when a user gets mentioned in a change as
long as a signature is added in the same section.

Bug: T138938
Change-Id: Ie183fbb8150bd9451a5b0a9fea0227e3241b26a0
2016-09-14 12:36:22 +02:00
jenkins-bot 5fd9831c07 Merge "Send mentions when editing multiple sections in between sections." 2016-09-14 10:06:36 +00:00
Catrope bba984c002 Revert "Make seen/unseen badge more consistent across wikis"
Has bugs, and will likely cause deployment problems.
This'll need to be reverted in wmf.19 at least
until we fix it up.

This reverts commit 00e0b9f45d.

Change-Id: Ia9d220ebcb607f96dee6bc856755305ed8501fcc
2016-09-13 14:21:32 -07:00
Translation updater bot 86eb821204 Localisation updates from https://translatewiki.net.
Change-Id: I3a1cb76405a9a1887735dce229ae11d5708b30d5
2016-09-13 22:49:49 +02:00
jenkins-bot 1f3517e562 Merge "Fix seen time for new users" 2016-09-13 17:31:59 +00:00
jenkins-bot f223b04920 Merge "Add {{GENDER}} support to dynamic action messages" 2016-09-13 17:26:45 +00:00
jenkins-bot 4063a26c0e Merge "Allow for count cap display in Special:Notifications sidebar" 2016-09-13 17:26:36 +00:00
jenkins-bot 1159a14b1f Merge "Generalize getCappedNotificationCount and move to counter" 2016-09-13 16:07:18 +00:00
Moriel Schottlender fcc2e1ddfc Allow for count cap display in Special:Notifications sidebar
Some of the counts are capped (wiki counts) and some are not (page
counts) - so we are adding a config option ('isCapped') to the
widget to make sure that capped numbers appear with the proper
i18n message ('99+' in English) and non-capped numbers appear
as-is.

Bug: T144707
Change-Id: I7332e7f5108621d0bd403edefe4feacca44b1f88
2016-09-12 16:35:38 -07:00
Moriel Schottlender dbd2f4ccf7 Generalize getCappedNotificationCount and move to counter
This follows the generalization we made in the back-end and allows
us to always use the same method to get capped notification count
in the display.

Bug: T144707
Change-Id: I4d7f406b05a195972dca0d2088bde2ff739d313d
2016-09-12 15:32:52 -07:00
Moriel Schottlender cc36178e4a Add {{GENDER}} support to dynamic action messages
Make sure we pass the current user to the message, since empty
{{GENDER:|}} doesn't seem to work in PHP.

- Add parameter to documentation
- Add {{GENDER}} syntax to en.json as example
- Add parameter to the message creation

Bug: T144538
Change-Id: Ifc5e3bbe8309cc9ce120b7d61cdc050d7055aacc
2016-09-12 15:30:29 -07:00
Moriel Schottlender 5e8377b2f6 Make sure to use mw.language.convertNumber on displayed counts
In the special page, the counts should always display with
mw.language.convertNumber.

Change-Id: I9acafff9a35f2d3a1eb83ad003e57491905cb233
2016-09-12 22:02:13 +00:00
jenkins-bot 28248c0cc2 Merge "Actually insert target page entries when creating an Event" 2016-09-12 21:32:03 +00:00
Translation updater bot bbf4453c6f Localisation updates from https://translatewiki.net.
Change-Id: I4586f151db255fcf154aade64717db2c3920fe96
2016-09-12 23:04:12 +02:00
Stephane Bisson d7845da3f6 resetNotificationCount() from replica with no lag
When notifications are being moderated, the unread count
for affected users has to be recalculated.

It was initially done using DB_SLAVE but it was leading
to inconsistent data since that database did not know
about recently deleted notifications.

It was changed to DB_MASTER but it potentially led
to too many queries on master.

This patch tries to wait for the replica to have
caught up with those changes and use it to update
the unread count for the affected users.

Bug: T93673
Change-Id: Ib4a845e82f686dd7ed807ab21a28490014b56604
2016-09-12 19:59:02 +00:00
Stephane Bisson bc03468473 Actually insert target page entries when creating an Event
This was broken in Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a

Bug: T145232
Change-Id: Ieaad1febaf07bdcf8aee3761afbd039c082fc9ad
2016-09-12 15:05:18 -04:00
jenkins-bot 7f24836607 Merge "Make PresentationModel::getPrimaryLinkWithMarkAsRead() final" 2016-09-12 13:28:05 +00:00
Translation updater bot 2e920d22b7 Localisation updates from https://translatewiki.net.
Change-Id: I8f750d6157a8c16a87ab5c4b08de0359fc2b5ab2
2016-09-11 22:49:29 +02:00
Kunal Mehta 7051cfb2a5 Make PresentationModel::getPrimaryLinkWithMarkAsRead() final
Subclasses should not override this. Also fix the return type phpdoc of
getNotificationCountForOutput().

Change-Id: Ia6963794d3a68dca742fe52ac197edf1575bed76
2016-09-11 12:46:08 -07:00
Translation updater bot f9311bf281 Localisation updates from https://translatewiki.net.
Change-Id: I8c4fc1fe16a6a4b54dfb3e07fa807c913d46e07b
2016-09-10 23:28:41 +02:00
jenkins-bot c01b053025 Merge "Remove js-truncation of descriptions in Special:Notifications desktop" 2016-09-10 02:49:02 +00:00
jenkins-bot 421f955ada Merge "Always cap notification count based on MWEchoNotifUser::MAX_BADGE_COUNT" 2016-09-10 01:39:43 +00:00
Moriel Schottlender 615ffb1125 Always cap notification count based on MWEchoNotifUser::MAX_BADGE_COUNT
Also increase Echo version so we update the cache.

Bug: T144707
Change-Id: Ie939d313c8c6a8168fa3eb3036d9275270575559
2016-09-09 17:15:15 -07:00
Matthew Flaschen 98c6cd9eab Fix seen time for new users
Until the user opens the popup the first time, everything should be
unseen, rather than nothing unseen.

Also, make the default 'everything unseen' if we forget their seen
time.

Change-Id: I99ff8d46d4fa2fab0db374ddff63727b18a68363
2016-09-09 17:46:34 -04:00
L10n-bot b6ae9a4b52 Merge "Localisation updates from https://translatewiki.net." 2016-09-09 20:59:43 +00:00
Translation updater bot 4058116901 Localisation updates from https://translatewiki.net.
Change-Id: I2912cac6c11c88455a1369dc0c0ca1f2b924bc41
2016-09-09 22:54:20 +02:00