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
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
* 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
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
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
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
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
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
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
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
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
Implements whitelists and blacklists for notification agents to assist
in filtering out unwanted notifications from bots.
Bug: 47946
Change-Id: I0d7e071067c6974fb90cf6c0ba1bd159f46bd5df
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
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
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