Commit graph

195 commits

Author SHA1 Message Date
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
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
jenkins-bot e11614bc85 Merge "[4] Add revision local cache holder object" 2014-08-19 17:58:28 +00:00
jenkins-bot 51dda5473c Merge "[2] Add title local cache holder objects" 2014-08-19 17:57:22 +00:00
bsitu 55fb42b681 [4] Add revision local cache holder object
Change-Id: I85f68b3ca269c711a8a177e013bd8eba38833444
2014-08-19 10:28:38 -07:00
bsitu 1270da19e8 [2] Add title local cache holder objects
Core titleCache doesn't do what I expect it to do, issuing
Title::newFromId( 1 ) mulitple times would issue multiple
idential queries to the database. It doesn't return what's
already in the cache.

The goal of this patch is to batch load titles via newFromIDs,
and save the number of mysql queries

Change-Id: I8fe767ac2669e67bdf7d17eecccfc0dcb6b5fc7d
2014-08-18 13:52:40 -07:00
jenkins-bot 7fac1c3ee8 Merge "Use batch queries for users-watching-title" 2014-08-18 08:33:13 +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
jenkins-bot f001382328 Merge "Add TargetPage model and mapper to notifications" 2014-08-14 20:18:44 +00: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
bsitu 029668423d Add TargetPage model and mapper to notifications
This will be used for marking a notificaiton as read when
a user visits a target page. The new table should keep the
volume as low as possible for fast data loopup. records
should be removed from the table once it's marked as read.

Change-Id: I605cbc79adfc12d22bd889c5bb513d05c479fe6e
2014-08-13 00:48: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
jdlrobson 8d12ef9a80 The first ever Echo QUnit tests
Also change coding conventions of Resources to allows use
array for scripts key.

Change-Id: I0c9f358ce3eb62adb07b68623e97c07993c9c45c
2014-08-06 13:26:42 -07:00
bsitu 427b7e2c38 Add support for splitting notifications into alert & message
Change-Id: I8eeeeb9a7a1539a258bc42584274897f9e7dc775
2014-08-05 14:50:54 -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
jenkins-bot cf418a4ecb Merge "Generalize a couple implementations of EchoGetDefaultNotifiedUsers" 2014-08-02 00:10:42 +00:00
Erik Bernhardson 71c7e02858 Directory reshuffle, add dev tools
* Port Flow Makefile to Echo
* Move resources to Resources.php

Change-Id: I75e96cc1e51a7768600ffc083550fc94ea9d1e6c
2014-08-01 22:38:41 +00: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
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
Max Semenik 1dd635a773 Add ParserTestTables hook handler
Otherwise, it explodes when trying to run tests via PHPUnit:
Error: 1146 Table 'osmiumwiki.parsertest_echo_notification' doesn't exist (localhost)

Change-Id: I8a3e0171ab022e8e2973ea8bed9aacba73a35f34
2014-06-25 18:06:09 -07:00
Kunal Mehta e4f97802db Split user rights changes into their own category
This will allow users to disable them if they wish to.
By default, both web and email are enabled for all users, which
is the current default.

This also fixes a bug in the EventLogging portion where user rights
changes would be logged with a user id of -1, instead of the
actual user.

Bug: 55337
Change-Id: I026b9392b085e295fbcd375095c9aed682fc29a2
2014-06-15 18:39:23 -07:00
Siebrand Mazeland 0730ff8d67 Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I45c23439d25b081d932ff4354fd3308122e5b186
2014-03-26 15:22:57 +01:00
bsitu bc57eb7535 Prevent double email notifications on talk page edit
If a user is watching his/her own talk, an edit to the talk page
may trigger an echo notification and watchlist notification.  We
only want to send one of them

Depends on core patch: https://gerrit.wikimedia.org/r/#/c/114682/

Bug: 53569
Change-Id: Ib1bb71e047789d3a857f028aaa45384022bb35c7
2014-03-14 14:05:49 +00:00
Kunal Mehta 1ea7332cc1 Remove dependence upon $wgPasswordSenderName
Fallback to 'emailsender' message if not set

Change-Id: Id136692b80b7582a515501672259394e8db74112
Follows-Up: Id20e4ec1cdae94fadb278146cd72d5a9b247dccf
2014-02-24 22:09:27 -08:00
Ori Livneh 761f3e5664 Update Schema:Echo revision to r7572295
Removes the enum constraint from the notificationType property.

Bug: 61698
Change-Id: I84e8f874ea730eb65151dd011274b3ff0376bf25
2014-02-20 14:40:34 -08:00
Matthew Flaschen d889fd6cc6 Use mediawiki.ui.button instead of mediaiki.ui
* 9e4e58bce8d10f65cf298b39f48e86c41b6a82b8 separated mediawiki.ui.button
  into a separate module (for modularity, and potentially to allow
  wiki content to use mw.ui buttons by default in the future).
* Currently, the button code is in both mediawiki.ui and
  mediawiki.ui.button for backwards compatibility.  However, it will be
  removed from mediawiki.ui when existing uses transition over.
* Echo does not use any mw.ui features other than buttons.

Change-Id: I429d8f2424d6218439eed01fe5ea6497e7697ba2
2014-02-04 21:07:52 -05:00
Kunal Mehta 1240492018 Add new messages indicator from a hook
So it works for users without JavaScript

Bug: 56974
Change-Id: I0652a740ca7156257d4459931d80872877339c0d
2014-01-12 03:31:46 +00:00
theopolisme fc7e18ba8e Mention: notify correctly if there is no section title
If a user is mentioned in an area that does not have a section
title (for example, the lead section of a talk page), use the new
'notification-mention-nosection' message, to avoid an awkward and
incorrect "[[Page#|]]".

Bug: 52507
Change-Id: I40628b76c460c79008053222c9780bb23549731d
2013-11-22 21:31:45 -06:00
Timo Tijhof c1f022ecae Remove exclusive module group to reduce HTTP request fragmentation
Cache groups should only be used when it is worth to have the
module(s) in a separate request. Echo is relatively small and
stable in terms of cache combination, not worth it to force
its modules to be in a separate http request as all other modules.

Change-Id: I198b5664d662c93c593d048efcfaf4aac765a6b9
2013-11-07 23:16:44 +00:00
jenkins-bot af3d8c30eb Merge "ext.echo.alert: Restore orange background on Monobook" 2013-11-02 23:27:59 +00:00
jenkins-bot a1388d0096 Merge "Remove class constant variable reference from Echo.php" 2013-10-29 05:10:07 +00:00
MatmaRex dc1443f57f ext.echo.alert: Restore orange background on Monobook
Core styles for Monobook include high-specificity background: transparent;
rule for #p-personal li a, we need to match it to set our background.

Also change hover behavior: switch to a deeper orange instead of
default white, similarly to how the badge already behaves.

Partially reverts I682182fe.

Bug: 56214
Change-Id: I9f343264c395ecf09c1e34e03d208ec2119fb622
2013-10-27 15:30:22 +01:00
jenkins-bot fc41b4a613 Merge "Update to latest revision of Echo schema" 2013-10-25 05:41:22 +00:00
Kunal Mehta 18b09b5daa Update to latest revision of Echo schema
This patch updates Echo to revision 6081131 of Schema:Echo, adding a 'rev_id'
field and the code to populate it. The patch also increments the logging
version identifier to 1.5.

Bug: 46045
Change-Id: I4ac1a25c306b0e0983a3490a29fe3dc4aa4bfc6f
2013-10-25 05:40:05 +00:00
bsitu 71e27f4b7a Remove class constant variable reference from Echo.php
This is causing fatal error in update.php

bug: 55469
Change-Id: Ib0a354addd44542f7ec4eda427c0b530f33e6c12
2013-10-23 12:31:35 -07:00
Kunal Mehta 790f4bee9e Remove "Talk:" prefix from "You have new messages"
Bug: 49324
Change-Id: I51d9fc5c891d4489fcb5bce74b0428575f1df7f6
2013-10-21 11:56:20 -07:00
Ebrahim Byagowi 88937d21c1 Native digits on 'mw-echo-overlay-title-text'
Change-Id: Icdd52ea0267ffbaa0e103070655735eff8423ca1
2013-10-13 19:34:03 +00: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
kaldari 4380e81afe Moving dependencies from ext.echo.base to more specific modules
mediawiki.api and mediawiki.Uri are desktop-only modules that are
not actually needed by ext.echo.base. Moving the dependency
declarations to more specific modules so that ext.echo.base is
usable by mobile notifications. ResourceLoader is smart enough to
not double-load them, so there should be no performance difference.

Also removing unused 'cancel' message.

Change-Id: I9fa8c4501e038ded9125c3b43e5207c355af2db9
2013-09-25 17:58:11 +00:00
kaldari 08fc83b6de Cleaning up Echo 'base' module.
Removing unused functions and declaring correct dependencies.

Targetting to desktop and mobile so it can be used by both.

Also removing dismiss-related code from the formatter.

Change-Id: Icccce64cfb3c564ab468a93ccdba9c5a61687fd5
2013-09-23 11:29:49 -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
jenkins-bot 8df26c9386 Merge "Updating eventlogging schema revision number for mobile data" 2013-09-05 01:47:23 +00:00
jenkins-bot 1bb1e9ff73 Merge "Remove Echo preference change eventlogging" 2013-09-04 18:09:58 +00:00
kaldari 9793138d4f Updating eventlogging schema revision number for mobile data
Change-Id: I28b5c9bda0a97ec69d10dd24e4345b8bd1363899
2013-09-04 11:03:06 -07:00
kaldari dc46848c5e Updating headers in Echo.php
Change-Id: I05b20f59cff94185a91c7f6e5f1f52dc034eafb4
2013-08-28 10:38:52 -07:00
bsitu 08e2dd4ddb user-rights notification primary link has incorrect message key
The current message key is notification-learn-more, but this message key
is not defined in the language file, it should be echo-learn-more

Change-Id: I4e2f19e3663727ff8c4083fd295c80cb350297c4
2013-07-31 17:18:23 -07:00
bsitu 0b1275b9e3 user talk and mention notification improvement
http://www.mediawiki.org/wiki/Echo_%28Notifications%29/Feature_requirements#Improved_Notification_Structure

Change-Id: I2da35e8ed092c42ac95ae34012426834a37c3cde
2013-07-29 18:07:43 -07:00