Commit graph

60 commits

Author SHA1 Message Date
bsitu 8e2de3f02b Add support to retrieve unread + read notifcations for section
Change-Id: Ife3750400315f545f5f3e54ac9847f56c2efe9be
2014-08-19 16:54:48 -07:00
jenkins-bot 1ee7e52f90 Merge "API: Fix help url and remove deprecated getVersion()" 2014-08-14 21:49:00 +00:00
Kunal Mehta ae171aa6ed API: Fix help url and remove deprecated getVersion()
Change-Id: I3394d53e63c199be7318202eb74e6bcc4e7ad887
2014-08-14 14:33:23 -07:00
bsitu ff0784e7da Add support to mark all as read for "sections"
This also updates the way how mark all as read works

Change-Id: Ifb7b1b7b7feb4a5af65c79bb16b91a5a9c70166c
2014-08-13 17:16:19 -07:00
jenkins-bot fd5bfe80b7 Merge "Hygiene: Add abstract model and mapper for notification" 2014-08-13 15:26:38 +00:00
bsitu ad691fb838 Use array_merge_resursive when merging based on array keys
When two array have the same keys, we want to merge them into one array
rather than one overwriting another one

This was preventing count and rawcount from appearing inside the messages
and alerts object returned by the API.

Change-Id: I989b9b0994a33925faf52c6d99d8c46920e62cd6
2014-08-13 00:42:07 +00:00
bsitu 4bf88aa741 Hygiene: Add abstract model and mapper for notification
* Shared function can be put in the abstract class and this also enforces some interface methods 

* Initialize a default dbFactory when it's not passed to the mapper

Change-Id: I1033dafaa90a1f683fbe9ad69bed04f4844e357b
2014-08-13 00:11:15 +00:00
Brad Jorsch 33af802a61 Update token handling for core API change
Core change I2793a3f2 changes API handling in a way that needs updates
to extensions for proper operation:
* needsToken() now returns a string
* Most custom token types are being replaced with a 'csrf' token (the
  former 'edit' token); any others need a new hook.
* All tokens must use a static salt. Compat with web UI using non-static
  tokens is supported and also serves to handle the now-deprecated token
  fetching.
* Documentation in getParamDescription() should return a string (not
  array) for 'token', as the signal to core that it should be replaced
  with a standardized message.

When compatibility with earlier versions of MediaWiki is no longer
maintained, the entry for 'token' from getAllowedParams() and
getParamDescription() may be removed, as may getTokenSalt(). This patch
leaves them in place.

Note this is intended to be compatible with earlier versions of
MediaWiki, and so should be safe to merge before the core change.

Change-Id: I7cbdc5a7119cdfeadc1fe55469065a44c228a006
2014-08-09 16:30:07 +01:00
bsitu 427b7e2c38 Add support for splitting notifications into alert & message
Change-Id: I8eeeeb9a7a1539a258bc42584274897f9e7dc775
2014-08-05 14:50:54 -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
bsitu 77239e17de Fix a function param in API
The distributionType is still passed to the function, it will
be arry of event types in next patch

Change-Id: Ieae7cfc383c2a024256f7e6b2f91d3b5c323f79b
2014-07-31 11:28:57 -07:00
Erik Bernhardson 04f04f8db2 Refactor ApiEchoNotifications preparing for alert/messages split
Change-Id: If4a79a3c775070bcaed62b6330920f7d82c16f69
2014-07-31 18:11:42 +00:00
bsitu d3d99772b9 Replace EchoBackend with mappers and gateway
* Get rid of EchoBackend by separating responsibilities into smaller objects

* Move main fetchNotification logic from API to a more appropriate place

* Add more unit testing coverage

Change-Id: I42f4d7566543332588431c21c220c0d64d026b70
2014-07-31 10:29:52 -07:00
Thiemo Mättig e205992d0b Remove unused code and fix missing/broken documentation
General code cleanup as reported by the PHPStorm static code
analysis. I hope it's not a problem that I made a lot of very
different (but all very tiny) changes in a single patch. If you
want to merge this but you think it's better to split it into
several patches first, please tell me.

Change-Id: I2e2c4bb47f8d20e038d28e236e2ff813b30504af
2014-06-04 04:54:00 +00:00
jenkins-bot f34f50da07 Merge "Remove markread action from the read API" 2013-12-10 02:00:37 +00:00
kaldari 7633707071 Removing constructor that doesn't do anything.
Change-Id: I8b6c1d3a88e57f970fd1edef1b4df1b8bf9785e4
2013-12-02 15:12:53 -08:00
bsitu 974abfa034 Suppressed agent name should be hidden in API
bug: 56230

Change-Id: I7cac877ef0ff44a3f64828ae37ced874b720ad27
2013-10-30 11:53:06 -07:00
bsitu 3b3ed1e3bc Fix some notification badge related issue
* In some languages like persian, the number 0 is represented as '.', we can't compare
  '.' with either 0 or '0' to detect the no-notification status of the badge

* The markread API doesn't respect uselang param, it would return 0 instead of . in a url with uselang=fa

Note: we need to provide raw and formatted count in the API since client side javascript
      doesn't provide fancy function like $wgLang->formatNum()

bug: 54575

Change-Id: I0a49828253ec346ed27c5b9a976f8bdff4e1fa90
2013-10-02 11:25:05 -07:00
bsitu e19e8cd5b5 Remove markread action from the read API
Don't merge till parent patch 84468 is merged and deployed

Change-Id: I863cf068754723701c26ba575c94a9852cac240e
2013-09-18 14:32:16 -07:00
bsitu 2b57fbd3c2 Split the Echo API into their own write/read APIs
Change-Id: I0ab85c91c6fbe17e9a1c7dc9e504980f629a5065
2013-09-18 14:28:41 -07:00
bsitu 06e7317472 Archive page and overlay should respect ?uselang=xxx
In addition, any message used in the email should be
sent in the user's language.

Bug: 52992
Change-Id: I3585f28d4ec97b86a467958bdfd603791f293d52
2013-09-09 13:44:05 -07:00
bsitu dcb669b8c1 Date header should be converted to user local time for comparison
bug: 53285
Change-Id: I62a87f9c5f03bf3473357d64f1266d93065262c0
2013-08-23 17:46:54 -07:00
bsitu f79c6a2e0f (bug 48568) Bust IE browser ajax cache + some API clenaup
Change-Id: Iaacdf41d85dc31a07d3d981086bcd919ba1a40e2
2013-07-18 10:31:23 -07:00
bsitu 12fa60fa23 Some more adjustment to timestamp in user timezone
* The timestamp used for loading more should always use UTC timestamp since
  that's the format saved in the database

Change-Id: I249725a6972b95dddd9074ffe08343b1a805c111
2013-06-13 11:32:06 -07:00
kaldari 0fd7915801 Switching to short date headers based on user prefs (and timezone)
This change will allow people to switch between 'May 10' and
'10 May' as requested in bug 47211. It also now corrects for the
user's timezone settings.

Bug: 47211

Change-Id: I7c5eae52857fac2d82ff1cb0b10864a1e1b30b6a
2013-06-12 17:45:40 -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
bsitu 4909715dbe Date comparison should include year
Comparing only the month and date is not enough, a date header for
the same month/date last year would be parsed as today

Change-Id: Ief4e047bdd91ac39fa62cc2c0a5134e35abd7c4f
2013-05-17 14:31:20 -07:00
jenkins-bot 9a2f91e18f Merge "(bug 48054) Echo API should use a standard continue parameter" 2013-05-13 23:23:04 +00:00
bsitu c130197682 Add extra security check to Echo API to prevent vandalism
1. Only trigger mark as read if the unread notification count is > 0
1. Add a limit to the number of notification that can be marked as read
2. Only update those records with read_timestamp = null

Change-Id: I12456c504787f45f594ef9283e98d98692956935
2013-05-04 19:58:37 -07:00
bsitu a70208e8fe (bug 48054) Echo API should use a standard continue parameter
Change-Id: I1d5333db4a4d58a1ecfa8dfe562cda5a35093f8b
2013-05-03 18:15:46 -07:00
jenkins-bot a4ee5ce444 Merge "(bug 48011) notlimit parameter does not accept "max" as a value" 2013-05-02 23:26:50 +00:00
Krenair b19be6c4ca Fix API in XML format
We weren't setting the XML tag name used for notifications, so this was causing a fatal error.

Bug: 48009
Change-Id: I676f7e7fee1167d02ed35920719105d3ca260e74
2013-05-02 11:44:36 -07:00
bsitu 1394e39b10 (bug 48011) notlimit parameter does not accept "max" as a value
Change-Id: I6bb7272b5a3df5fe9ccd3cf78a24769ca38a3f20
2013-05-02 10:56:46 -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
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
Kaldari fcb5d99b37 Fixing dismiss functionality for new checkmatrix system and categories
Change-Id: I3b64c4853587d4d2d8f04fc97c9b3ddb15b520ed
2013-03-07 15:11:46 -08:00
bsitu b98b7b69bf Remove unused pretty timestamp
It is not used anywhere and we are going with a completely different approach

Change-Id: I9c8cbbcacd6dfdf6a7767f784a4b8b80b9c606ee
2013-03-05 10:34:20 -08:00
Reedy 62a433573f Numerous bits of method parameter documentation
Change-Id: Ie4b2657b5e010311b779aa587aa7fa9fc3f19abb
2013-03-01 10:56:58 -08:00
Kaldari af06e26de6 Adding dismiss functionality to special page
Includes new web preferences for Echo

Also adding ability to set dismissability per notification type

Still need to arrange subscription options into a friendly format

Still need to add dismiss functionality to flyout

Change-Id: I484a24b424e69be3640e63b76f82735edae6f13a
2013-02-12 11:33:50 -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
Kaldari c3e9ad0534 Support for limiting notifications to a specific user group or groups
Change-Id: I396bb6cb540bb6e8bdc190ddb1b67e15166c6852
2013-01-16 17:22:10 -08:00
Kaldari 05e186c7a3 Setting up flyout formatting as a separate formatting option
This is replacing the implementation I did for 'html-light'.
The reason html-light doesn't work is that we don't have any way
of reliably determining which parameter should be the one that is
linked to in the notification title (flyout notifications are only
supposed to have one link). With this system, the notification
definer can specify a separate message/params combination to use
specifically for the notification flyout. If they don't specify
these, it falls back to the normal title message/params.

Change-Id: I35394849cf99307eba4a76e079333d19514fdb5d
2013-01-08 09:53:31 -08:00
Kaldari d6ad22ed81 Separating html and html-light formatting for notifications
Change-Id: I388b8bbcce741005b34b87d7331e22d442ef1c9b
2013-01-02 17:52:07 -08:00
bsitu 363f8e9dd1 Remove 'extra' data from API result
1. We are not using 'extra' in API calls.
2. In some cases, we are storing private information in 'extra' data, this would expose those information

Change-Id: I3d8e03c3e01b1cc8832ac98d85a3a74e41865913
2012-12-12 12:29:05 -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
bsitu 86c3b094d8 $language->prettyTimestamp is expecting 3 arguments
Change-Id: I58daf0fd93891bf3d6c7a76d56ffce2c4af5f3b3
2012-10-25 22:47:45 +01: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
Siebrand Mazeland 950f74eba8 Follow-up I2c10cb69: Auto-formatted using IDE.
Change-Id: Iedeaca3c31195a5cf7df8dd38d6332cfabffcc67
2012-08-31 23:50:46 +02:00