Commit graph

219 commits

Author SHA1 Message Date
Alangi Derick ba4789760c IP addresses should link to Special:Contributions instead of user page for revert
This changes the revert notification (special page version) to link
to the contributions page for anonymous (logged out) editors.
It still links to the user page for logged in editors.

Bug: T55564
Change-Id: Ib1f17fb88237b96cda63dd30ed488a8ffd84750e
2015-09-20 15:53:10 -04:00
Matthew Flaschen f9c5808912 Move edit-user-talk to messages
Also:

* Clear the newtalk flag when they mark all their edit-user-talk
  read.

* Remove the section caching system.  It was designed to avoid
  performance problems with Flow messages, but now that standard talk pages
  are in 'messages', messages should be relatively common (alerts
  were already not cached by this).

* Minor cleanups to reflect that messages are not only Flow (and
  a typo fix in the Gruntfile).

Bug: T108760
Change-Id: I82d7b1d08331693830d6a1749612b55e96b95cf9
2015-09-04 18:36:40 -04:00
Kunal Mehta 064c1f1514 Load only the EchoInteraction schema client-side
The other schemas are not used client-side, just server-side.

Bug: T105220
Change-Id: I5e5e7b01998cee38693c9f5e22da6e86a5e13e96
2015-07-08 13:17:35 -07:00
Kunal Mehta 4d8b977ff9 Get rid of disabled 'echo-notify-show-link' preference
This preference has been disabled since bug 47562, and doesn't make
sense to keep around given that the flyout is the main interaction most
users have with Echo.

Change-Id: I7e8ddf96dbde9a95ac01a0cc83bad396151d01bd
2015-07-07 17:10:49 -07:00
Kunal Mehta a7c36b0b86 Flip EchoEvent::getUseJobQueue() default
Rather than making each notification type opt-in to using the job queue,
make them opt-out by setting an 'immediate' => true flag.

Configure the 'edit-user-talk' notification type to be immediate since
it should not lag behind the orange bar indicator.

Change-Id: I707bc01a97082887c3f1c353d45cdf1c1eaeff04
2015-07-01 20:36:47 -07:00
Kunal Mehta 06d9385fbb Don't use $dir
Change-Id: I2e376c15cd6fdddcf037985eb20702c2aaa8c177
2015-06-15 17:45:03 -07:00
Kunal Mehta 1298f2bb74 Don't hook into ourselves: EchoGetNotificationTypes (part 2)
Change-Id: I51600bbb26594323831d22bc35d34587ff146d47
2015-06-15 17:43:54 -07:00
Kunal Mehta df452abbb6 Don't hook into ourselves: EchoCreateNotificationComplete (part 1)
Change-Id: I5f0f3929a3b0396c98e0f3e74b69ddcee744a0e8
2015-06-15 17:41:10 -07:00
Kunal Mehta 70761a124c Cleanup LoadExtensionSchemaUpdates hook
* Use standard "on{hook}" naming pattern
* Skip hook if using an external database server ($wgEchoCluster)
* Don't return true, it's not necessary anymore

Change-Id: I488e4636f9499c468b870966614b0762c2ade8ea
2015-06-02 00:55:54 +00:00
Kunal Mehta 0e6976f536 Require Resources.php in entry point
Extension loading should fatal and stop if Resources.php cannot be loaded.

Change-Id: I62f3095438e3702e0a41e1a4ad6721ec31f432fc
2015-06-02 00:55:50 +00:00
Kunal Mehta c78e5202e8 The OBOD is orange
c.f. https://meta.wikimedia.org/wiki/OBOD

Change-Id: Ib3efe9ea59d1b955be86e56cfa8841c2c4daedb6
2015-06-02 00:55:36 +00:00
Kunal Mehta c2258dd7ce Kill $wgEchoCohortInterval
The Echo cohort study was finished in July 2013 and hasn't been used
since. The code was also checking in reverse order, for example it
checked registration before checking whether the survey was still
active.

EchoHooks::isEchoDisabled() was removed, and all callers were checked to
make sure they were also checking for anonymity.
EchoNotificationController::doNotification() will throw an exception if
the user is anonymous, since it shouldn't be possible to get an
anonymous user into that code path.

Bug: T101047
Change-Id: Iada2f6d2066c0f6bba5cc58aeb03d687632ac5a4
2015-06-01 17:53:29 -07:00
Kunal Mehta e11fa6e094 Kill $wgEchoBackendName
All uses of $wgEchoBackendName were hardcoded to 'Db' and removed.

This exposed a interesting bug in MWEchoEmailBundler which was
instantiating a subclass using the parent class's private constructor, a
"feature" of PHP which is supported in 5.2.6+ (http://3v4l.org/h4Mq3).
While it worked, PHPStorm complained about it so I made the constructor
protected, which makes more sense anyways.

Both EmailBatch and EmailBundler need further refactoring, but that will
be done in follow up patches.

Change-Id: I2032f5b2f4f3a62f830cc5344b25a92074bd0c61
2015-06-01 12:13:11 -07:00
Kunal Mehta 94dd86f255 Simplify registration of EventLogging modules
Let EventLogging register the schema modules by using the
EventLoggingRegisterSchemas hook.

Don't modify $wgResourceModules at run time because that's a hack.
Instead register the module in the ResourceLoaderRegisterModules hook
itself.

Change-Id: I9457546c1ec38cf6896fe6f9f445fe1191afe72a
2015-06-01 11:58:37 -07:00
Kunal Mehta 5e4fc8661e Remove todo that we're not going to do
Echo should not care about the job queue backend, that's MediaWiki
core's responsibility.

Change-Id: I29c349e0fedec31a3ad0f28e020849778e155c00
2015-06-01 11:33:44 -07:00
paladox 2e59b04866 Remove i18n shim
Change-Id: I180cbbced3a9bab95baa37a7a6fc25870e8a6bbf
2015-05-27 10:55:20 +01:00
umherirrender 9b02538429 Replace deprecated $wgSpecialPageGroups
$wgSpecialPageGroups is deprecated since 1.21
override SpecialPage::getGroupName instead

Change-Id: I92eee336132de57b9759ba67fed1f060bd6a881e
2015-05-15 22:41:09 +02:00
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
Tony Thomas 89b88ce61f Unreachable code in Echo hooks
Removed function EchoHooks::getDefaultNotifiedUsers

Change-Id: I5a2d219c3daea87705776f76744a8e7753e01fac
2015-04-20 21:51:23 +05:30
Erik Bernhardson 37cb659f0a "More info" link on Special:Notifications has broken localisation
Bug: T58036
Change-Id: I56f89ecc022dc648d55928ab5b8f02bb01f67617
2015-02-26 12:18:58 -08:00
Ricordisamoa 01773a6d97 Add 'license-name' matching SPDX conventions
References:
http://spdx.org/licenses/
https://www.mediawiki.org/wiki/Manual:$wgExtensionCredits#license-name

Change-Id: I3debc1db6b821efeca07be05e1795f223d2fa621
2015-01-29 14:58:20 +01:00
Erik Bernhardson e69c63813e Hygiene: autogenerate $wgAutoloadFiles lines
Change-Id: I4f4d9f9d1c9dde0471611271ceb1ae074d19df72
2014-10-23 12:09:33 -07:00
Kunal Mehta fae2556494 Add UserMerge support
Depends on Id1726673 in UserMerge to allow specifying
a custom database object to use.

Bug: 67766
Change-Id: Iceb4b8d2fd53c50ed00a4aab9bc374f4bb716466
2014-10-17 10:08:59 -07:00
bsitu 55ef794d74 Add job to keep user notifications in reasonable volume
Change-Id: I4d4fa4c987a1732e5e29536a7669e28c34d4ab18
2014-09-29 23:10:18 +00: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
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