Commit graph

274 commits

Author SHA1 Message Date
Stephane Bisson 24caf50ff6 Dynamic bundles
To allow individual notifications to be
marked as read/unread or moderated,
bundles are created by grouping associated
notifications when they are fetched for display
instead of when they are created.

From a product perspective, this change doesn't
introduce moderation or expandable bundles but
it counts each individual notifications.
For instance, the bundled notification
"3 new topics on PageA" now counts as 3
notifications.

Bug: T93673
Bug: T120153
Change-Id: Iacd098573efd92bb1e3fcd7da4cd40cea9522f15
2016-06-27 09:49:13 -04:00
Roan Kattouw 617cd3d29e Add index on notification_event
So we can easily query the notification rows that belong to
a given event row. This is needed for the removeOrphanedEvents
maintenance script to run efficiently.

Change-Id: I99fc31a62b37259d7000577583c8e8a599e400f9
2016-06-14 19:57:06 +00:00
Stephane Bisson b06b2294c9 Allow the primary link to set all bundled notifications as read
Bug: T136368
Change-Id: If07369cb168d1a085f297293e713d65e49997264
2016-06-14 08:49:23 -04:00
jenkins-bot db322eec76 Merge "Don't set title to Main Page for user-rights notifications" 2016-06-09 17:15:51 +00:00
Roan Kattouw cc3c38458b Don't set title to Main Page for user-rights notifications
I mean, WTF? It might make sense to set it to the user's
user page I suppose.

Change-Id: I584c1150e4c98bb814e30bf6a6d3eb3e49ef6408
2016-06-09 17:15:03 +02:00
Roan Kattouw 4c6cadfb27 Add script to remove orphaned event rows
Bug: T136425
Change-Id: Id42a893be81176f37d9d5e3fd7e850d3a6d42e10
2016-06-07 23:34:53 +02:00
jenkins-bot 2d3a031b47 Merge "Add diff link to page-linked notification" 2016-05-26 23:33:58 +00:00
Brad Jorsch 14046ada09 Update for AuthManager
* Replace AddNewAccount hook with LocalUserCreated
* When AuthManager is enabled, use it instead of AuthPlugin when
  checking if the email address can be changed.

Bug: T110285
Change-Id: I7e28c574ae6e3b5443e39b38e12a9bded31c283b
2016-05-26 12:10:45 -07:00
Roan Kattouw 71eacf3fad Add diff link to page-linked notification
Will only show for new instances, because the information
will be unavailable for old ones.

Bug: T135959
Depends-On: I3d894acaf3d85b790e5034c7d9f76bf94672f445
Change-Id: I04620678dd0ebffb3b1a92a9a0587cb7557d77f4
2016-05-23 12:23:30 -07:00
jenkins-bot 62d401de78 Merge "Fix indenting in onResourceLoaderGetConfigVars hook method" 2016-05-20 15:47:46 +00:00
addshore 99272a779c Specify public access in Hooks methods
Change-Id: I26a513a14e0c152e8801c99e27f24261d03caed6
2016-05-20 11:10:51 +01:00
addshore 5756b556da Fix indenting in onResourceLoaderGetConfigVars hook method
Change-Id: I2d9e982ee9c60aee0b75e76a5a56b9b7b2bbec65
2016-05-20 11:09:51 +01:00
jenkins-bot 5a2faf26da Merge "HTML email formatter using presentation model" 2016-05-14 00:29:30 +00:00
Roan Kattouw 0e2f1a9c18 Add $wgEchoCrossWikiNotifications flag to disable cross-wiki notifications
This is needed because global tables and cache keys will attempt to be used
even for users who don't have the preference enabled.

Bug: T135266
Change-Id: I6208a12d46c8cd0275a232663cd50ac2bd2fed1c
2016-05-13 13:52:54 -07:00
Mark A. Hershberger 50611ad682 Respect editmyprivateinfo for email
Had set this so that users on a corporate wiki couldn't modify their
email, but saw that Echo wasn't respecting it.

Bug: T135152
Change-Id: I1c7840e4f0648ab20ccc89ae281eb86cddad516c
2016-05-12 11:21:10 -07:00
Stephane Bisson 6f6e10084c HTML email formatter using presentation model
Bug: T121067
Change-Id: I77f466f0b507ffa49a9714ddba95bea8db1d8438
2016-05-12 09:29:24 -04:00
Roan Kattouw b5bec3ad24 Use new OutputPage parameter in OutputPageCheckLastModified hook
Depends-On: I044a5920b703a2d61a74c2d83d184b77caebb8f3
Change-Id: I6c4290baaf1f2d9e5ec098bc4ea2b23762b4f70f
2016-05-11 17:58:44 +00:00
Roan Kattouw d2d420a3c4 Don't cache pages with outdated global notification counts
When updating notification counts, we already called User::invalidateCache(),
which bumps the local user's touched timestamp, which is taken into
account by OutputPage when computing the last-modified timestamp of the response.

However, this only works for one wiki, while the changed global count
needs to be displayed on every wiki. To accomplish this, track the
timestamp of the last update in NotifUser, and hook it into
OutputPageCheckLastModified.

Change-Id: I22c88a017f18a28179906049ee423c2d7e81c939
2016-05-11 10:53:13 -07:00
jenkins-bot f08b108e2e Merge "Replace mark-as-read-on-click with ?markasread= URL parameter" 2016-05-04 01:09:27 +00:00
Roan Kattouw 7942a2de79 Replace mark-as-read-on-click with ?markasread= URL parameter
Notifications were being marked as read in response to a click event
in JavaScript, but that causes a jarring effect in the UI, and it's
not reliable (the browser could abort the AJAX request).

Instead, add ?markasread=XYZ to the end of every primary link URL,
where XYZ is the event ID.

Bug: T133975
Depends-On: Icb99d5479836fea25a47451b5a758dd71f642f71
Change-Id: I8047d121584b43e6172463a50ad0e0de5f7fa73c
2016-05-03 00:20:03 -07:00
Roan Kattouw 0807c3c5ad NotifUser: Refactor getNotificationCount() and friends, add caching for global counts
Previously, getNotificationCount() only looked at local notifications,
and foreign notifications were added in separately by getMessageCount()
and getAlertCount(). This didn't make any sense and resulted in
counter-intuitive things like I4d49b543.

Instead, add a $global flag to getNotificationCount(). If $global=false,
the local count is returned as before, but if $global=true, the
global count (=local+foreign) is returned. If $global is omitted,
the user's cross-wiki notification preference determines which is returned.

Update getLastUnreadNotificationCount() in the same way, since it had
the same issues.

Also add caching for global counts and timestamps, using a global
memc key.

Bug: T133623
Change-Id: If78bfc710acd91a075771b565cc99f4c302a104d
2016-05-02 16:16:57 -07:00
Roan Kattouw 4f7f1a3a09 Repurpose survey call-out in the footer for beta feature invitation
Removing the info popup because we don't have to show
a privacy notice when linking within the wiki.

This adds a database query to every page view for logged-in
users; If78bfc710, once merged, will fix that.

Bug: T117669
Change-Id: I8451db34ae8e94264e4921ecd6df6e4b32c7623a
2016-04-27 07:23:30 +00:00
Matthew Flaschen 5ecc6aa7c8 BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical
Merge and deploy at the *same time* as:
* BounceHandler - I3c669945080d8e1f67880bd8a31af7f88a70904d
* mediawiki-config - I13817c139967ed9e230cfb0c87c5de66da793c96

Despite claiming to be about categories, $wgEchoDefaultNotificationTypes
was actually configuring both categories and types (which go inside
categories).

For example, 'thank-you-edit' is a type, but 'emailuser' is both
a category and a type (when used as a category, this has special
effects at Special:Preferences).

Since types and categories can and sometimes do have the same names,
this leaves no way to properly and clearly configure them.  It also
makes it difficult to document what is going on (as required by
T132127).

Split into three variables:

$wgDefaultNotifyTypeAvailability - Applies unless overriden

$wgNotifyTypeAvailabilityByCategory - By category; this can be and is
displayed at Special:Preferences

$wgNotifyTypeAvailabilityByNotificationType - By type; this cannot
be displayed at Special:Preferences. To avoid confusing the user,
we introduce a restriction (which was previously followed in practice,
AFAICT) that types can only be overridden if the category is not
displayed in preferences.

Otherwise, it can look to the user like a category is on/off, but the
types within might have the opposite state.

Due to this configuration change, this is a breaking change, and needs
coordinated deployments.

This also lays the groundwork for T132127

Also change terminology to consistently use "notify type" for web/email.

It was mixing between that and output format (which unfortunately
sounds like the API format, e.g. 'model').

Bug: T132820
Bug: T132127
Change-Id: I09f39f5fc5f13f3253af9f7819bca81f1601da93
2016-04-22 19:08:12 -07:00
Kunal Mehta f35251fce6 Never show a negative number in the notifications badge
If we calculate a negative number should be shown, just show 0 instead.

Bug: T130853
Change-Id: I6e061525d034276cbb9e307eff53b77ddb06ef9a
2016-04-11 01:20:08 -07:00
jenkins-bot f082457d27 Merge "Revert "Add GENDER support to tooltip messages"" 2016-04-02 15:07:59 +00:00
Siebrand 543d75c472 Revert "Add GENDER support to tooltip messages"
There was no need to merge this, and I suggest it is reverted. Parameterless use of GENDER is supported
 already.

"{{GENDER:|male|female|other}}" will switch for the
current user.

This reverts commit c8b80f2003.

Change-Id: I15a0bd79abea9d9f0e9b0547c87e848ebf88b5de
2016-04-02 13:41:56 +00:00
jenkins-bot e9de6bbc29 Merge "Add GENDER support to tooltip messages" 2016-04-01 09:58:38 +00:00
Justin Du c8b80f2003 Add GENDER support to tooltip messages
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Echo-pref-tooltip-mention/es

Change-Id: I10228205785527b273c1fd06af85fcc26df9e583
2016-03-31 22:50:17 -05:00
Moriel Schottlender e50ef3841a Add footer notice widget for invitations for feedback
Add a mw.echo.ui.FooterNoticeWidget that includes a link to
a feedback survey, and three config variables:

* $wgEchoShowFooterNotice: Enable this feature per wiki
  (Defaults to false)
* $wgEchoFooterNoticeURL: The URL for the survey
  (Defaults to '')
* User preference 'echo-dismiss-feedback-alert': determines
  whether the user permanently dismissed the feedback alert.
  (Defaults to false)

Bug: T128937
Change-Id: I918a70beaba7b173e764519fe4fe0f780b61082d
2016-03-18 17:02:31 -07:00
jenkins-bot 8b15325346 Merge "Make plural support for large values (100 or more) explicit in l10n" 2016-03-17 21:53:40 +00:00
jenkins-bot c7cdd8bf20 Merge "Always show a cross-wiki notifications preference, even if the beta feature is disabled" 2016-03-17 10:05:03 +00:00
Matthew Flaschen cac85b635f Make plural support for large values (100 or more) explicit in l10n
This involves:

* Making this value no longer admin-configurable.
* Changing getNotificationCountForOutput to return only a single value
  Since there is no + in the formatted value anymore, we can actually
  use the same value for both.

  This is a B/C break, but hopefully worth it to simplify the method
  call.

  For now, the excess parameter is just marked unused.  It could be
  removed at some point if the translations are updated.

This must be merged at the same time as:
* Flow - Ibfa56b1af9e8c56b4c5f900e0d487bc09688b2a2
* MobileFrontend - Ibf784b279d56773a227ff261b75f2b26125bbb63 (well, MF
  can be merged first)
* translatewiki - I2a4b6938aed49e4101deb6b9351c43656a863490

Also, change 1 to One/one, per Siebrand on the task.  This can easily
be dropped/undone if we don't want it.

Also, remove reference to no-longer-existent notification-page-linked-bundle

Bug: T127288
Change-Id: Iabeaae747f99980c0610d552f6b38f89d940b890
2016-03-16 18:43:16 -04:00
Roan Kattouw cc88450477 Always show a cross-wiki notifications preference, even if the beta feature is disabled
In the non-BetaFeature case, put it in the Notifications tab instead.

Bug: T129077
Change-Id: I116bec24e0725b3d84276593a50f4315981d2ab1
2016-03-11 11:59:49 -08:00
Kunal Mehta c99a93dd5c thank-you-edit: Cast counts as integers before comparing
Because somehow we're ending up with 100 !== 100 in the logs.

Change-Id: I9c24b5dca3fea7d52fc0e0a52e53702385eb0fb1
2016-03-11 11:30:15 -08:00
Matthew Flaschen 07c962e82f thank-you-edit: canRender for deleted page and extra fix
Don't try to render if page was deleted, and fix 'extra' parameter
(was breaking message key and thus rendering)

Bug: T129641
Change-Id: I5d0fdfd3921427993211969eb5793f8e9e7667a8
2016-03-11 13:59:27 -05:00
Kunal Mehta 26a8bc2450 Defer onPersonalUrls() DB writes to post-send (try #2)
This reverts commit e372f3ce6f.

The previous attempt was broken because
EchoTargetPageMapper::fetchByUserPageId() returns a list of
EchoTargetPage objects, not a single one.

Bug: T117531
Change-Id: Id02a025e3736a7b92d9d6fb8adf29ef674f8e2fa
2016-03-09 11:07:50 -08:00
Kunal Mehta 51dd4fd109 thank-you-edit: Only call User::getEditCount() once
And rename $editCount to $thresholdCount for clarity.

Change-Id: I115b2dfabf472c855c186d05fa4e31aa7c9c3d6c
2016-03-08 17:05:05 -08:00
jenkins-bot acdcb5c895 Merge "Revert "Defer onPersonalUrls() DB writes to post-send"" 2016-03-09 00:11:50 +00:00
Catrope e372f3ce6f Revert "Defer onPersonalUrls() DB writes to post-send"
Causes fatals in production for some reason.

This reverts commit 93387806c2.

Bug: T129299
Change-Id: Ie90aa493e2940fae9d6f380b95f87a4cc7e04622
2016-03-09 00:00:11 +00:00
Roan Kattouw e85c3832bb Add debug logging for when the thank-you-edit code detects a race condition
We seem to be discarding *all* thank-you-edit notifications as
race conditions now.

Bug: T128249
Change-Id: I1f284bd13e89fe2205c4c87a6c0f4a7dfe1c8bd1
2016-03-08 12:04:45 -08:00
Aaron Schulz 93387806c2 Defer onPersonalUrls() DB writes to post-send
We calculate how many messages and alerts are being marked as read, and
subtract them from the count since the database and caches won't be
updated until the end of the request.

For performance, we also get the event_type while doing the
EchoTargetPage lookup query to avoid having to query it individually
later on.

Bug: T117531
Change-Id: I0d9302adf1b4b07a4ff26a04b00d4498aa3fe7ee
2016-03-08 01:41:52 +00:00
Kunal Mehta 8d99490108 Try and avoid race conditions with thank-you-edit notifications
Wait until after the main transaction has been committed before checking
whether they have the right number of edits.

Bug: T128249
Change-Id: I38cc0f96e97fda3692340cc8906144a002594ef2
2016-03-03 21:48:01 -08:00
Stephane Bisson eb873aaa60 Include cross-wiki notifications in unread count
* Client-side only. The backend already counts those.

Bug: T124109
Change-Id: I62e49524bc8cea1ef2d77255e29ff8a919bd1ee7
2016-02-29 16:02:05 -05:00
Kunal Mehta 3a29b1112f Add some debug logging to thank-you-edit notifications
Bug: T128249
Change-Id: I074cfa51e1d45a6dcc5a1316ef4e83e20319f8a6
2016-02-28 22:13:25 -08:00
James D. Forrester 23ebee2a61 Provide three more edit threshold congratulatory notifications
Change-Id: Icd213fe7dd7ab8451432d35d6ee289c49449d5d1
2016-02-26 15:51:25 -08:00
jenkins-bot e0b5d8c397 Merge "Don't process null edits (or other warnings in article save process)" 2016-02-24 21:39:36 +00:00
Stephane Bisson bbef0c15b4 Remove footer from email notification excerpt
Bug: T127098
Change-Id: I7de634ddcde65cb006afc18e95d83229ecbda6c1
2016-02-24 07:48:38 -05:00
Matthias Mullie e22675c880 Don't process null edits (or other warnings in article save process)
Bug: T123843
Change-Id: I5ce4deb2ad71ae6355fae31bbce68dc147aa0137
2016-02-24 09:27:18 +01:00
Kunal Mehta 7fbec72803 Always show the messages flyout icon
Bug: T127731
Bug: T124372
Change-Id: Ie97229b7ef34cd807f16c76ceae0682c425c53b4
2016-02-23 01:21:28 -08:00
Stephane Bisson dff7e8072b Include reason in user-rights notification body
Bug: T126277
Depends-On: Ib9bb28a7a77602e3e729fd0bf13ab8259e15b006
Change-Id: I4941c4ba16ee95798767d858792090609b47b4e4
2016-02-16 01:51:07 +00:00