Commit graph

183 commits

Author SHA1 Message Date
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
jenkins-bot 1ba7583985 Merge "Introduce AttributeManager class" 2014-07-31 20:45:31 +00:00
jenkins-bot c9ed159ea7 Merge "Clear up cached Main_page title in test" 2014-07-31 18:52:32 +00: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
Antoine Musso 0dbff3bf16 Clear up cached Main_page title in test
In Echo tests/NotificationFormatterTest.php there is a test that ends up
invoking the Linker to create full URL for Main_page and pass it a
fragment.

Title::newMainPage() is really Title::newFromText('Main_Page') which is
cached.  Whenever the fragment is set, it stuck in the cache entry and
later call to Title::newMainPage() yields a Title object which has the
fragment.

That cause Scribunto tests (at least) to fail when Echo tests are run
before it because Scribunto tests expect a Main_Page title without a
fragment.

The ugly workaround is to have the Echo test to reset the fragment.

We could clear up the Title cache between tests though.

Bug: 68646
Change-Id: I625492fc8bf0dbd6e10275c3a728f5c1f85768c8
2014-07-29 13:56:28 +02: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
Thiemo Mättig ab9c69dc28 Fix failing tests
Guys, your tests are failing. :-( I can't submit my other patch
because of this.

Change-Id: Ibba5b07205fd45edb73f562c9ca9429487dacafa
2014-05-27 19:39:52 +02:00
Kunal Mehta 8922b9dda6 Mark EchoTalkPageFunctionalTest::testAddCommentsToTalkPage as broken
Bug: 65336
Change-Id: I6a5f3e0d1e65436bce816027a78007040fcae108
2014-05-15 01:02:15 -07:00
Kunal Mehta e35e071e0b Remove namespace restriction for mention notifications
This is unlikely to cause issues since a signature is
still required.

Bug: 55491
Bug: 56311
Change-Id: Ice51ae05b581b98f1d8a90104e1707c3a590b39d
2014-02-21 21:06:05 -08:00
Erik Bernhardson fcd4f67c93 Catch catchable fatal errors when formatting echo notifications
Change-Id: Ieaf02ece716802309e85ed0e32a0a15fcd24c50d
2014-02-06 15:06:54 -08:00
Yusuke Matsubara 17fa9cadde Properly get timestamp position in DiscussionParser
The code was looking at the [0] element for the matched position
of timestamps, while preg_match returns it in the [1] element.

Bug: 53132
Change-Id: Ibfd3f2b86b007f28f73a137defb80276fb830d28
Follows-Up: I6c636b055bcd25760aee848aea71fe4044c7e1be
2014-01-30 07:28:51 +00:00
Kunal Mehta f2c876c4b5 Disable DatabaseBase constructor
Broke in I094185585dc844ca4d2d8b629107b2ab8f9bef39

Change-Id: I9ef09cfef07906cc5034a56f9b27eccd79f0d4ad
2013-11-07 15:51:46 -08:00
Kunal Mehta 61f1754d14 Unbreak the unit tests
Not all installations will have a user with the id of 2,
like jenkins. At some point User::getOption is called, which
requires loading the user from the database, except it
doesn't exist. At which point the user id is reset to 0,
so it becomes an anonymous user, breaking the test.

Since the MediaWiki test runner automatically
creates a test user, we can safely assume that there is
a user with the id 1.

The other failure was due to that $wgUser may not
always be 127.0.0.1. The test now directly just
calls $wgUser to avoid issues if another test has
altered the global state.

Change-Id: Iacf904d04f1ff5aaf584cb98c3083ef6d7d89cea
2013-11-01 08:13:11 +00: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
bsitu 7f33cc98fa (bug 46665) Add HTML email support to email digest
Change-Id: I3b881acbcf4b18fc0401364ea0a6bc993d2c2246
2013-07-23 13:20:33 +02:00
bsitu 2c74f66f18 Add HTML email support to Echo notification
To test the HTML email:

1. install the latest version of php-mail and php-mail-mime package, they are required
   by the core sendmail function to send HTML email
2. set $wgAllowHTMLEmail = true before loading Echo in LocalSetting.php

Change-Id: Ia4b98b14e135742b84f1b0e04589b0efdd24e954
2013-07-23 13:20:33 +02:00
Erik Bernhardson 34fbeaf8c9 Respect revision suppression within Echo
Update the echo formatter to properly display suppressed revision content

Bug: 48059
Change-Id: Iee3c9a41ad24c66b0e2abdd5f1375ebdbd74314e
2013-06-18 11:00:50 -07:00
jenkins-bot fea4484b68 Merge "Database updates for respecting oversight within Echo" 2013-06-11 00:01:02 +00:00
Erik Bernhardson f38ce97efd Database updates for respecting oversight within Echo
Provides the first step of adding and populating a new database field
for Echo oversight deployment.  The new field is populated via a
maintenance script and Event::loadFromRow will accept both new and old
results.  Everything will still run when the 2 now unused fields are
later dropped from the db.

Bug: 48059
Change-Id: I24d4b61a061f94ed9aaaa6087f33b2ab37f773cd
2013-06-10 14:52:18 -07:00
jenkins-bot 5ae087d7c9 Merge changes Iedbe3404,I65fdc6d9
* changes:
  Link to any heading not just a main heading
  Better detection of multiple changes in a document
2013-06-05 18:07:31 +00: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
Erik Bernhardson 9bcb5cc94c Link to any heading not just a main heading
Echo's detection of section links was limited to the main heading that have
==Foo==, with exactly two ==.  This updates the regexp patterns involved to
correctly detect(and hence, link) to sub sections if thats where the edit was
made.

Bug: 48484
Change-Id: Iedbe3404ec265a7f2183629b463a3d672dc9098e
2013-05-28 12:07:17 -07:00
Erik Bernhardson 1d7b766754 Better detection of multiple changes in a document
Detects changes to different parts of the document as independent from each
other. Refactored parser passes all tests the previous parser passed plus
a number of new tests which fail with the original parser.

Change-Id: I65fdc6d9f922cbe9ff684332945def3776c70d30
2013-05-24 16:37:00 -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
jenkins-bot e6769b3391 Merge "Accept diffs formatted by UnifiedDiffFormatter" 2013-05-20 17:43:20 +00:00
Erik Bernhardson e058b980b5 Link directly to the edited section from edit-user-talk events
Adjusted the edit-user-talk event creation to detect and record which section
of the talk page was edited. Flyout, special page, and email messages have
been adjusted to use this section title as a URL fragment when available.

Bug: 46937
Change-Id: I161e2ffda2f2540f64de90cc621fb3b69479d0db
2013-05-16 17:13:16 -07:00
ebernhardson db2669d7a0 Accept diffs formatted by UnifiedDiffFormatter
GNU diff and mediawiki's internal UnifiedDiffFormatter do not have
the same default formats.  Here we adjust the output of the internal
diff to match gnu diff as is expected by DiscussionParser.
Bug: 41689

Change-Id: Ib83cacab41adfbdfa8e122c0494b266d4caefc83
2013-04-29 17:21:13 -07:00
Siebrand Mazeland 950f74eba8 Follow-up I2c10cb69: Auto-formatted using IDE.
Change-Id: Iedeaca3c31195a5cf7df8dd38d6332cfabffcc67
2012-08-31 23:50:46 +02:00
Krenair 9559105b59 Use whitespace between function parameters and the brackets.
Change-Id: I2c10cb69f1f1726b63d25579c6a35c882cc1fe7e
2012-08-30 17:04:39 +01:00
Andrew Garrett 0699d8f402 Formatting updates for Echo.
First implementation of "two line" formatting.
Messages have a title and optional content.

Distinguishing writing on "your talk page" from another talk page in messages.

Change-Id: I9051e4bfb66d1c25c1bf68ec092b52fd90544336
2012-08-01 10:37:17 -07:00