Commit graph

60 commits

Author SHA1 Message Date
bsitu 55ef794d74 Add job to keep user notifications in reasonable volume
Change-Id: I4d4fa4c987a1732e5e29536a7669e28c34d4ab18
2014-09-29 23:10:18 +00:00
bsitu b320555cb1 wfDebugLog exception if thrown during formatting
Some exception is not loggable, which won't be logged by
MWExceptionhandler::logException(), we should log it in
the debug log for debugging purpose

Change-Id: I709c45f7e47afacb98be3a869eb5b70660e18f48
2014-09-11 11:37:25 -07:00
Erik Bernhardson 97417af20c Mark notifications as read if they fail rendering
The only issue is that the badge is not up to date till
you refresh the page, I think that's fine for now

Change-Id: I585b4cc185bf859ddb06829df75309ff3d56d8b8
2014-09-08 14:22:10 -07:00
bsitu 65bb14b33e Specify which event type to use job queue
This will allow us to specify which notifications to use job queue

Change-Id: I7bf576acf332f5344b35188b5262df2319d15b79
2014-08-27 11:39:53 -07:00
Reedy 7859b148ce Fix Call to protected method EchoNotificationController::isWhitelistedByUser()
Change-Id: I1f53172d70785c1d4def400b785442e7512ec92c
2014-08-26 19:58:34 +01:00
Erik Bernhardson ae3b1f2944 Hygiene: Move notification type detection to method
* Moved most of the content from notify to getEventNotifyTypes
* Added phpunit test verifying per-event config overrides defaults
* Remove special-snowflake welcome handling with proper configuration

Change-Id: Ic1aae11d37f23f2b7b8abe3c1edaa414e29be021
2014-08-22 14:05:47 -07:00
Erik Bernhardson 57130aadf1 Hygiene: Move master/slave code to MWEchoDbFactory
Change-Id: I1b36bab2126b12359b00c5623885117ef17d0768
2014-08-22 14:01:57 -07:00
Erik Bernhardson 768d0fc513 Reset per-user notify types for each user
The code was passing the notifyTypes in the hook for each user, but
the second user would get passed whatever made it through the first
user.

It is unlikely this is intended.  Give each user a fresh set of the
configured notify types.

Change-Id: I13059d380ea54c71cd1c062fd803897f5e5ad2b8
2014-08-19 18:58:44 +00:00
Erik Bernhardson 1667e25854 Use batch queries for users-watching-title
The new locateUsersWatchingTitle implementation could end up returning
thousands of users, currently on enwiki there are 25 titles with more
than 10k subscribed users and aprox 550 titles with more than 1k subscribed
users.

This switches the user collection to an iterator based implementation so that
we no longer need to have the entire users list at any one time.

Change-Id: I3d3fa9328f348bb48682d3658622952ce82d3925
2014-08-15 10:44:55 -07:00
bsitu 4e63ee6164 Hygiene: Update method documentation & split exception to a file
Change-Id: Id77db0f21ee3fdaad4e040c853fadc605df212ea
2014-08-04 17:43:57 -07:00
Erik Bernhardson 74a56e6fc4 Convert existing notifications to use user-locators
Replace implementation specific code with generalized user-locator
implementations that can be re-used by more notifications in other
extensions.

This patch adjusts the `user-locators` notification parameter to allow
arrays which facilitate passing options to the locator.

Previously(still works):

    'user-locators' => array( 'foo', 'bar' ),

New functionality:

    'user-locators' => array(
	'foo',
	array( 'bar', 42 )
    )

In the second example the callback specified by `bar` will receive
an EchoEvent as the first argument and array( 42 ) as its second
argument.

Change-Id: I7305279bc91d1e40e7054e2fd42a819a35526b82
2014-08-04 11:16:34 -07:00
Erik Bernhardson f995de90c8 Generalize a couple implementations of EchoGetDefaultNotifiedUsers
There are a variety of generic strategies you could define to choose
which users should be notified about an event, such as 'users watching
the title' or 'talk page owner' (User_talk only).

This adds a new way to generically implement these in Echo and expose them
to other extensions rather than having each extension implement these
generic strategies themselves.

This patch only converts one notification, edit-user-talk. The remaining
notifications will be converted in future patches. The first user of this
will be Flow for notifying all users watching a particular talk page in
I4e46a9c003fbdde274b20ac7aef8455eab4a5222

The users watching title implementation provided here is minimalist, a larger
refactor to accomidate pages with thousands of watchers is being handled
in I3d3fa9328f348bb48682d3658622952ce82d3925

Change-Id: I19bb6a794d22565f3bb5421de92426d390197796
2014-08-01 12:31:53 -07:00
bsitu 267a56398e Introduce AttributeManager class
This is a precursor to splitting notifications into
alert and message sections.

Change-Id: Ic685f7026ab9b41407b51317780bbfadd05bf9f1
2014-07-31 11:41:00 -07:00
Erik Bernhardson fcd4f67c93 Catch catchable fatal errors when formatting echo notifications
Change-Id: Ieaf02ece716802309e85ed0e32a0a15fcd24c50d
2014-02-06 15:06:54 -08:00
Erik Bernhardson 425a4a09fa Catch exceptions formatting notifications
Provide users a better user experience by catching and logging
errors with Echo notifications.

Bug: 60906
Change-Id: Iee93a05c6eed468af8bbfa60249df0819c49c45b
2014-02-05 13:55:27 -08:00
Kunal Mehta d1e13a6da7 Remove deprecated call to Job::insert
Change-Id: Ie5a2e7a9d5506dc787161dfd40ebb3c4244dcec1
2013-10-07 14:23:19 -07:00
bsitu ec18d637b9 Adding Echo jobs to deferred update along with master wait
This is in case job queue is picking up the job too fast when the current
transaction is not completed and job queue is trying to access non-committed data

When job is popped, some of the object is re-initialized from the database, this will
handle the replication lag

Change-Id: Ia7debb4db0103f27a3e326beb52db0f63bc7c0bc
2013-09-04 17:32:54 -07:00
kaldari 972e14672f New primary and secondary link behavior for Echo
See https://www.mediawiki.org/wiki/Echo/Feature_requirements#Flyout
and https://www.mediawiki.org/wiki/Echo/Feature_requirements#HTML_single_email_notifications

Also includes some related style changes per Vibha

Also removing feedback link from overlay since it's no longer needed

Change-Id: I94aed697e87126ed8ad6d1d416c99bafaa53ac53
2013-06-27 16:12:16 -07:00
bsitu 7c19d0243f (bug 49142) Notifications Productivity A/B Test
Change-Id: I209a55bc78fc307603710296b75ebe774ebdcbac
2013-06-10 15:22:27 -07:00
bsitu 71f250e0c6 (bug 47912) Visiting talk page should mark talk notif as read
This needs some more manual testing and adding unit testing

Change-Id: Iadfe3cf7927d5318f89ba17f067000f9399060af
2013-05-29 20:43:57 -07:00
jenkins-bot 3b96815e40 Merge "Switch to using our own badge instead of jQuery.badge" 2013-05-23 17:42:47 +00:00
kaldari f9481040d5 Switch to using our own badge instead of jQuery.badge
With this change we will no longer be relying on JS for the badge
functionality. This will prevent the flash of unstyled content,
and allow wikis to locally override the styling (since the unread
class is now applied immediately).

I also went ahead and made the badge styling more closely match the
talk page message alert styling per Vibha.

Also removed the old full link optional behavior since we weren't
using it, and it would have been a pain to maintain.

Bug: 48165
Bug: 48001
Change-Id: Ie85d66afd5181d487d0bb2776ae14b121ea50d88
2013-05-23 10:34:47 -07:00
jenkins-bot 3b5a2f0d14 Merge "Notification agent whitelist and blacklist" 2013-05-21 01:03:40 +00:00
Erik Bernhardson c0b0d78e50 Notification agent whitelist and blacklist
Implements whitelists and blacklists for notification agents to assist
in filtering out unwanted notifications from bots.

Bug: 47946
Change-Id: I0d7e071067c6974fb90cf6c0ba1bd159f46bd5df
2013-05-20 16:36:28 -07:00
bsitu 617488526b (bug 44247) Do not write to storage if read-only mode is on
Change-Id: I2e41cef0b5952c43cbba3374ac4da431b81c18ba
2013-05-14 13:48:05 -07:00
kaldari 5a4704e357 Only create notifications that are wanted by the recipients
Also moving getUserEnabledEvents from EchoBackend to
NotificationController since it has nothing to do with the backend.

Bug: 47664
Change-Id: I4f9682b861d9f035ae45f206c37ec0ae1c09ab64
2013-04-28 11:09:15 -07:00
kaldari 9448c6cab0 Add 'Mark all as read' button to overlay
Button is only shown if there are more unread notifications than
fit in the overlay.

To avoid performance issues, this version only works for cases where
the number of unread notifications is less than the maximum count
(99 currently). Otherwise the button to mark all as read isn't
displayed (it's also limited on the server-side for good measure).

Bug: 47092
Change-Id: Ifcb0a436e2b31062741c441cca239d35ddefa0e1
2013-04-18 00:29:36 -07:00
bsitu 6a3624b0e4 Add web bundling function to Echo notification
* add web bundling feature
* unify event_timestamp with notification_timestamp
* remove echo_subscription
* update article_link to page_link notification with new logic
* remove duplicated function from MWDbEchoEmailBatch since it's defined in parent class

Change-Id: I2fa91c44edb020209b468fe13f894d9db3732e69
2013-04-04 10:53:46 -07:00
kaldari 7a8fc68dee (bug 44056) Making sure user cache is invalidated by new notifications
Change-Id: I14491c1ba987bbf429ae9afcb7c32a2a5455e21f
2013-04-02 13:37:00 -07:00
bsitu 5c701f80ef Add getCategory() method to event object
Since every event is tied to a category, it's better for event object to have it as a member method

Change-Id: I911415284486bb11d13d91366340c5c330317c34
2013-03-18 16:30:39 -07:00
bsitu ded706dd73 (bug 46046) Notification should not be created for anon users
Anon users would not see or receive notifications, it is a waste of storage space

Change-Id: Id150be111337f434d0f1471bb8049ed75a0c53a5
2013-03-12 15:52:00 -07:00
Kaldari 8252026040 Using self for static methods
Change-Id: Iea3e7a7bdde9c7ac4d2da39edbc3bff80a68e4c6
2013-03-07 12:48:14 -08:00
Kaldari 8357f4bd75 Implementing new prefs system for Echo
Change-Id: Id745ed6cf1c92695569597fab6ea662bac8c76c0
2013-03-05 12:20:17 -08:00
bsitu 54c52b2a4e (bug 45591) Fix inconsistent function return type
Change-Id: Iccc4acb2bb809d0f957d73d6e8a4da3033839c1e
2013-03-01 01:23:10 +00:00
Kaldari 6347618db5 Fixing notification type to be 'web' in controller
Change-Id: Iab077a77aa75a6ff0cf03acecca38403595dda93
2013-02-14 12:07:23 -08:00
bsitu 78ad57d43a Abstracting MySQL in Echo so storage type can be swapped easily
Patch Set 6:
	* remove redundant JobQueueDB because it's the default
	* remove extra ;

Change-Id: I25dc0203ed5be1e4989242a87f4fde9c8799de28
2013-02-08 10:34:50 -08:00
Krenair eefab4076e Allow events to specify that they should notify the agent.
For I617eedce

Change-Id: I763db2f089e250c9f5486ed787ac71344e84abb7
2013-01-26 12:14:36 +00:00
Kaldari c3e9ad0534 Support for limiting notifications to a specific user group or groups
Change-Id: I396bb6cb540bb6e8bdc190ddb1b67e15166c6852
2013-01-16 17:22:10 -08:00
bsitu f1c31adacf More handling to replication delay
Change-Id: I7dd82d9ce010daafd0f687fd263947046d9a5e7a
2012-12-18 18:16:52 -08:00
Kaldari f897c02385 More prefs functionality for Echo
Patch set 16:
	* change some of the message rendering from plain() to escaped()

Change-Id: I9b971bd11171e73cd4d0c4ea10f817f4e19024f2
2012-12-13 16:57:15 -08:00
bsitu ad14fdbc57 Modification to all notification page
patch set 1:
	* Consolidate notification retrieval in API and Special page
	* Add load more function to special page with records as old as 7 days ago
	* Add support for browsers with javascript disabled

patch set 2:
	* Remove trailing whitespaces

patch set 3:
	* Fix some i18n issue
	* Fix variable names and some exta whitespace
	* Load core css files on special page rendering

Change-Id: Ic69e430b5eb196e5223a2bb6b1d447ef257d559b
2012-12-10 13:51:26 -08:00
bsitu cd349b11ac (bug 41866) Fix invalid notification in the flyout and page
1. Skip invalid notification events
2. Add formatting to notifcation count, for example, if the count is over 99, we just show 99+

patch set 2:
	* fix trailing whitespace
patch set 3:
	* remove extra whitespace and indentation
patch set 4:
	* change function name from gatherValidEchoEvent() to gatherValidEchoEvents()
	* add more descriptive documentation

Change-Id: I81a135c24f64fa1aace4dd2631e9b88bbe22d3d0
2012-12-03 11:41:16 -08:00
Kaldari 1c2a76ae22 Adding comments and fixing some incorrect comments
Change-Id: Iab1be6ad8700630f2cf3f97b5d5edd542f1c85ec
2012-11-26 18:20:53 -08:00
bsitu 26110aa080 Improve Echo Hooks
BeforeFormatEchoNotification and BeforeCreateEchoEvent Hooks would be executed multiple times because

	* An action may fire multiple notification events
	* The notification flyout and page have multiple notifications

we only want these hooks to run once to gather valid formatter and event

Change-Id: Ifff0ad34f3c44c31d88f982fd110ad3399ff5bd0
2012-11-01 15:59:47 -07:00
bsitu 5bf61444bc Add some useful hooks to Echo extension
patch set 2: update hook name from BeforeformatEchoNotification to BeforeFormatEchoNotification

Change-Id: I2286b72b0d5c8a562c47a0bad6ceeee429a9447b
2012-10-22 16:45:11 -07:00
Tychay 419f7b1cbb Merge "Add welcome notification for new users." 2012-09-04 19:03:09 +00:00
Siebrand Mazeland 69d91fa1b6 Update documentation and deprecated methods.
Basically having fun with the code analyzer.

Also:
* remove unused local variable assignments
* missing return values
* CSS optimizations.
* Initialize possible unset variables.

Change-Id: I77aa08ecb48eeda08f14dc38d7f35d57ea9fa110
2012-09-02 11:30:38 +02:00
Krenair 5714adf8f4 Add welcome notification for new users.
Change-Id: I14032b71ebe63bb6ef951ba0c14d6acf44e69d6b
2012-09-01 01:31:20 +01:00
Siebrand Mazeland 950f74eba8 Follow-up I2c10cb69: Auto-formatted using IDE.
Change-Id: Iedeaca3c31195a5cf7df8dd38d6332cfabffcc67
2012-08-31 23:50:46 +02:00
Siebrand 69803e5585 Merge "Use whitespace between function parameters and the brackets." 2012-08-31 21:43:23 +00:00