Commit graph

67 commits

Author SHA1 Message Date
Matthias Mullie da07893647 Display red badge based on time of notifications vs last time panel was opened
I tried to stick as close to the existing code as possible.

Special:Notifications is slightly different from the overlay,
however. I made it add .mw-echo-unread class for consistency,
but that JS doesn't record seen time (it only loads older
entries), not does the CSS fadeout apply there (it marks
everything as read as soon as it's displayed, so different
behavior from overlay)

PS: I'm not sure about browser compat for the fadeout. But
even if some obscure browsers don't support this, meh. It's
not an "important" feature that can't be missed.

Bug: T94634
Change-Id: Ibb201823fb52ef8a3d5eaa39b0b724ede8d271d1
2015-05-01 11:39:45 -07:00
Chad Horohoe 4a09f730e3 Remove obvious function-level profiling
Change-Id: I498d79d99ab6016cadf502f4c606a7a911470250
2015-02-10 14:32:58 -08:00
Kunal Mehta bf37b5261d Remove 'uselang' parameter hack which is no longer needed
ApiMain now has a 'uselang' parameter

Change-Id: Ifefc8aa09e51391ad2cf9c33beaf47848ed1f399
2014-11-05 13:34:42 -08:00
Brad Jorsch 09c881e1a0 Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-10-29 16:37:38 -04:00
Erik Bernhardson b552201829 I-2. Change the default number of Flow Messages in the flyout
Previously this was loading 25 unread notifications.  If less than 25 were
found it would add in 3 read notifications so it wasn't empty.

This patch changes things around to always return 25 notifications if the
user has at least that many.  Instead of backfilling a static count of 3
we backfill 25 - $count with previously read notifications.

Change-Id: I723316486216d7b9dacfcc9765c1a8212e973518
2014-10-15 10:08:00 -07:00
bsitu 669080b376 Add profiling to Echo notification API
Change-Id: I427622aa67037e33eabab02c0adf13a2abf59377
2014-08-27 17:26:58 -07:00
bsitu 17828f7953 Continue offset is missing in the read API
When the notification is retrieved without unread first,
it should have a continue offset for next batch of loading

Change-Id: I101990faaf9ed3e3786805aff3906b846d62f612
2014-08-26 13:12:22 -07:00
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