Commit graph

59 commits

Author SHA1 Message Date
jenkins-bot 59a8f9096b Merge "Require a Language object in DiscussionParser::getTextSnippet()" 2015-09-03 18:56:27 +00:00
Kunal Mehta 86da8324d5 Require a Language object in DiscussionParser::getTextSnippet()
To avoid using $wgLang directly. We still have to use it in
detectSectionTitleAndText for now though.

Change-Id: Ic901ed05d4e8f6291caa55d866ce58f7300880f5
2015-09-02 11:09:26 -07:00
Matthew Flaschen f38dfc4d08 Bump mention limit to 50
Bug: T110306
Change-Id: I724ef5467a087c70538a8780b856091260b40be4
2015-08-26 19:16:36 -04:00
Stephane Bisson f6bef9d159 Remove useless and misleading comment
Change-Id: Id4d2f908f3fdf4a37f3e5a1ddc6b205db745802e
2015-07-31 15:46:53 -04: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
Matthew Flaschen 3c37aefdb1 Separate logic for extracting usernames from picking the right one
Pull out the logic that extracts usernames from links.  This allows
it to be reused by the LQT->Flow import code.

Bug: T101979
Change-Id: Ib16a09cf1f388f56944cd1bb564384535728156e
2015-06-12 21:16:59 -04:00
Kunal Mehta add1eb8266 Remove unused EchoDiscussionParser::getNotifiedUsersForComment()
Change-Id: I63c51835f54735c04f8356cf8ce161210895c378
2015-06-09 23:38:16 -04:00
Stephane Bisson 5b72b9f026 Fix new talk page message notification
* Do not default section to footer. If the section
  is not found, it is left empty and the notification
  message is simpler.

* Change notification-edit-talk-page-email-batch-body2
  Replace : at the end with . so it does not look
  incomplete.

Bug: T99989
Change-Id: Ic982a81eada388d750760787245dea8f72368147
2015-06-03 13:17:57 -04:00
jenkins-bot 07ba07d649 Merge "Add fallback for enotiftalk in generateEventsForRevision" 2015-05-01 20:49:16 +00:00
Federico Leva aa3d1afda3 Add fallback for enotiftalk in generateEventsForRevision
Link the bottom of the talk page and use the edit summary as text
if the parser failed to find something. This is what core's enotif
does already.

Change-Id: Iadc7011ea2627e00f0c51472da7aad1355afeddb
2015-04-26 15:52:57 +02:00
Federico Leva fd532b82ca More explicit type matching in detectSectionTitleAndText()
Change-Id: I22c8dc5235f8b4b531c5bbd3ec98c19df7f449a6
2015-04-26 15:37:59 +02:00
Erik Bernhardson 6732f98f2d Hygiene: Delete commented out code
Change-Id: I0c04d03d876568ff023bd75062e3f89bd9248fb9
2015-03-19 15:51:07 +00:00
Matthias Mullie 0dee3d3587 Pass title along to signature parser
* Parser generates signature to compare against
* Signature can be overwritten per wiki, in NS_MEDIAWIKI
* Such overwritten default can be different depending on
  page the signature is on[1]
* Our comparison signature generation was page-agnostic
  (always from Title::newMainPage)
* Signatures didn't match up on own talk pages, where
  default signature is different

Also added 2 new tests cases & improved tests by also
setting the page

1: https://en.wikipedia.org/w/index.php?title=MediaWiki%3ASignature&diff=176507985&oldid=176229132

Bug: T78424
Change-Id: Ice151d4d16236a5d1556ef62805b61310c7beb85
2015-02-17 10:24:12 -08:00
jenkins-bot d3bfc5a5b9 Merge "Improve signature detection" 2015-02-06 01:21:27 +00:00
Matthias Mullie 58e1c765d6 Improve signature detection
Previously, there were a couple of hacks in play.
It was also not picking up ~~~ (signature without timestamp)
And it relied an a nasty regular expression which, although
based on Parser, may some day get out of date.
And it relied heavily on a specific signature format, which
isn't guaranteed (it's an i18n msg)

This patch changes the approach: it will use a very simple
regex to match links, and will send those through Parser to
generate the signature anew. My reasoning is that that should
be exactly the same as what Echo just received (should've
also gone through parser)

Biggest discomfort of this approach is that it's much stricter.
It should still match whatever it generated from a ~~~ or ~~~~,
but no longer the e.g. not-real signatures we were doing in
our tests. Also had to update our tests, because signatures
change depending on anon. So I had to generate all the users.
And fix some of the signature formats used in the tests.

Bug: T75426
Bug: T87852
Bug: T75366
Bug: T78424
Change-Id: Ibeff36397129fdd5d376f3668a23a45f9a014525
2015-02-05 20:45:19 +01:00
jenkins-bot 028388aa6c Merge "Bug: Fails signature detection with extra long signature" 2015-01-31 01:13:43 +00:00
Erik Bernhardson 438a7d5bb4 Prevent undefined index warnings
In some languages the \w+ does not match the characters used
when translating UTC and the regular expression attempting to
match the timezone fails. Testing in prod wikis where this fails
such as ne.wikipedia.org shows it still works, it just generates
a more generic regular expression.

Since the overall process still works acceptably on the wikis outputting
warnings this patch just adds a guard to prevent the warning and does
not attempt to fix the underlying issue.

Bug: T76558
Change-Id: If8e1ddd2d642b042cc24c51d5ba5aa8b34bc9552
2014-12-09 01:43:03 +00:00
Erik Bernhardson 2578c37d6c Bug: Fails signature detection with extra long signature
There were two different circumstances that could trigger echo's signature
detection to fail: multibyte characters in signature, and signatures near
$wgMaxSigChars limit that expanded past the limit due to wfEscapeWikiText().

This patch adjusts to use mb_substr to appropriatly handle the multibyte
characters, and adds a couple extra charactesr to $wgMaxSigChars to allow
for wfEscapeWikiText().  This isn't perfect, but a stricter implementation
would require much more work than i think we should spend here.

Bug: 73426
Change-Id: Ic51c2bc2a08600f188db13a9a0537f1321c9a655
2014-12-03 11:33:39 -08:00
Erik Bernhardson 4549a312cc Bug: parenthesis are allowed in namespaces
Bug: 73366
Change-Id: I7304046cfa7eda6356b2c61e716d76330cf1ee56
2014-11-13 11:52:06 -08:00
jenkins-bot 2946919a03 Merge "Limit Echo mentions to 20 users" 2014-10-27 15:40:38 +00:00
Erik Bernhardson 44ec374632 Limit Echo mentions to 20 users
Bug: 50082
Change-Id: I7eb0f41fc9b0e3a396383a1adaecf51dc883217f
2014-10-07 22:27:20 +00:00
Erik Bernhardson 8da75c3a50 Detect signature using Title class
Currently echo attempts to find a signature by looking for a series of
strings starting with what it thinks are the current aliases of NS_USER
and NS_USER_TALK.  This has shown to be error prone, see the linked bug
for how a change to ru.wikipedia.org/wiki/Mediawiki:Signature broke
mention notifications.

Patch switches things arround to pull wikilinks out of the text and run
them through the Title class.  The results of this parsing are checked
for NS_USER and NS_USER_TALK, giving a much stronger guarantee of finding
translated namespaces.

Bug: 71353
Change-Id: Ib0d0f4e068339d2fd28761087c05f5a1acb3c1fc
2014-09-30 19:06:16 -07:00
Erik Bernhardson 0f36db727e Hygiene: Convert value to constant and clarify outlier use case
Change-Id: I7a82fa99b41362368a9f58cfb84241cca97bfb15
2014-09-11 20:07:29 -07:00
Nemo bis 940ea72ab5 Remove trailing whitespace, followup 0b1275b9e3
Change-Id: I1d48f9c3c0af68496bf0672c76202bf00063cb34
2014-08-28 12:06:06 +03: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
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
jenkins-bot 6c11bf28f7 Merge "Support non-English namespace names in DiscussionParser::getUserFromLine" 2013-12-18 01:24:30 +00:00
bsitu 18cf0985df Avoid PHP warning in strripos()
bug: 56586
Change-Id: I9c70e28ca7495893f5a34a3f5ec301815de35e2c
2013-11-05 11:03:55 -08:00
Bartosz Dziewoński 3a519d5b37 Support non-English namespace names in DiscussionParser::getUserFromLine
Bug: 53132
Change-Id: I6c636b055bcd25760aee848aea71fe4044c7e1be
2013-10-03 23:08:35 +00:00
bsitu a0902ceca8 (bug 52313) Do not show text snippet with undecoded chars
Change-Id: I1760c8ab3f313241965c93571f9637c5b0aeebc4
2013-07-31 14:45:09 -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
bsitu 0947cfda34 Update mention notification threshold from 300 to 100
Change-Id: Iab02b076e4463d61a2986f16f1a756c48ecde0a6
2013-06-12 13:59:02 -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 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
bsitu f47349e303 (bug 47910) Minor edit should not trigger talk page notif
This patch makes Echo talk page notification mimic the existing Orange Bar and Email talk page notification
for minor edit.

For the Orange Bar, minor edit notification is sent if the editor does not have nominornewtalk
permission.

There are additional rules for the email, minor edit notification is sent if global $wgEnotifMinorEdit
is true and notification recipient has enotifminoredits option on.

Change-Id: Ib3835c4dd57a3686b227c44710a14ab06cded166
2013-05-06 10:31:55 -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
jenkins-bot d9a4bb7bb9 Merge "Pref for showing notifications" 2013-04-17 17:15:51 +00:00
Kaldari 6388779640 Pref for showing notifications
If this pref is turned off, we revert to the old orange bar talk
page notifications. Depends on core change Ifc8fbaf8.

Bug: 46550
Change-Id: If21f3aac51e484c5e077c7f4b5a2218e8b71ed2a
2013-04-17 09:55:05 -07:00
bsitu 7ca8d2e4a2 (bug 47023) Add array type check before being used in foreach loop
Change-Id: I28e7f1a52b337ee0a4b012ad31e8054c8f6798ed
2013-04-08 16:43:18 -07:00
Kaldari 6e8aa9b808 Merge "(bug 46046) Notification should not be created for anon users" 2013-03-15 00:33:49 +00:00
bsitu 345fdb81e2 (bug 46051) mentioned users should not be as object in database
Change-Id: Id96ade333d8150fdc357db47cba9a609f9e7e108
2013-03-13 12:30:20 -07:00
bsitu ded706dd73 (bug 46046) Notification should not be created for anon users
Anon users would not see or receive notifications, it is a waste of storage space

Change-Id: Id150be111337f434d0f1471bb8049ed75a0c53a5
2013-03-12 15:52:00 -07:00
Reedy 62a433573f Numerous bits of method parameter documentation
Change-Id: Ie4b2657b5e010311b779aa587aa7fa9fc3f19abb
2013-03-01 10:56:58 -08:00
Andrew Garrett dc6a3cb6d0 Add a "mention" notification
Any user whose user page is linked in a comment on a talk page will get a notification of that.

Weaknesses: Currently this mention notification is additive.
We may want to restrict it to only cases where the user would not
otherwise be notified of the comment

patch set 3:
	* user + instead of array_merge for merging subscription users
	* rename $user to $agent to avoid name confilict in generateMentionEvents()
	* add check for possible null object
	* users should not receive 'mention' notification on their own talk pages

patch set 4:
	* add more descriptive comment
	* check for empty notification list before creating mention event

patch set 5:
	* Fix a parse error, change [ to {

patch set 10:
	* rebase

patch set 11:
	* adding flyout messages, updating params for other messages

Change-Id: I76b80db1f325d9569f36c506d14c8c875bba4a34
2013-02-24 20:38:11 -08:00
bsitu a698cdbff2 Remove code for disabled event types
Change-Id: I30a5fec1e3275d53904c9bf20f2eb70db5fc0819
2012-12-19 17:00:19 -08:00
bsitu af027a0dd7 Remove redundant condition from if statement
Change-Id: I5e12b5766f9cc8aa546833756778c8cf2c3bddbe
2012-11-27 14:16:18 -08:00
bsitu 4bcc575ff8 (bug 41139) message snippets in notif should skip templates
patch set 2: remove trailing whitespace
patch set 3: remove unnecessary variable and add @return to function comment
patch set 4: remove redundant intval() and update commit message

Change-Id: I6abfa7d820433e008d8bdcc5843515cd4823dd02
2012-11-21 14:38:07 -08:00
bsitu 9fb50b353a Add database replication delay handling to Echo
patch set 3: Use Title::GAID_FOR_UPDATE instead of 1/0

Change-Id: I16bcec3699daaa143599cd50751521114f56aec3
2012-11-14 15:27:24 -08:00