Commit graph

99 commits

Author SHA1 Message Date
Umherirrender 3a72d87838 Remove unused DiscussionParser::stripIndents
Change-Id: I75fbcae70655c6db2873fd5e22d11a3c2cbf2f84
2017-02-22 18:05:07 +01:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
addshore 4010faaf89 Add some typehints & phpdoc
Change-Id: Ic5751f0745685ea4db009458b5976907dc22c518
2016-10-05 23:27:02 +01:00
Reedy 21faa050f6 Replace Revision::getText()
Bug: T147380
Change-Id: I3864fc64bd178471b1454033adbc9137485d1563
2016-10-05 00:42:45 +01:00
addshore cb575928a9 Count the number of success & failure notifs sent
Change-Id: I3e11bc8878ddf48265c628d828ee700f3aee7bbb
2016-09-14 13:35:03 +02:00
Jakob Warkotsch 3da89ea4d9 Send notification for mentions on changes
This sends out a notification when a user gets mentioned in a change as
long as a signature is added in the same section.

Bug: T138938
Change-Id: Ie183fbb8150bd9451a5b0a9fea0227e3241b26a0
2016-09-14 12:36:22 +02:00
WMDE-Fisch 4ac1711be8 Send mentions when editing multiple sections in between sections.
This patch fixes mentions not being send when multiple sections were added
in between sections.

Since we only want to send mentions when userlinks and signature are present
in the same section a new method was added extracting sections and the related
content from an addition. The results are checked whether a section content
contains a signature and might be relevant for mentions.

Bug: T141863
Change-Id: I434c664552bbadbeef6e897e20703e813f5a4c52
2016-09-08 15:15:14 +02:00
Stephane Bisson c75d974004 Provide title when parsing wikitext
Bug: T141460
Change-Id: I802c9c4bf964a060e44f25a487b5aec6f7d8c6b6
2016-09-01 16:48:56 -04:00
jenkins-bot 18a3da6b28 Merge "DiscussionParser stripSig from mention content" 2016-08-19 22:47:53 +00:00
Jakob Warkotsch 1afd529a67 Log potential notification for mentions on changes
This logs whenever a user gets mentioned in a change as
long as a signature is added in the same edit.

Bug: T138938
Change-Id: I2a775d1dcac6a947b353c8bd2f7be70b6384641f
2016-08-19 22:05:16 +00:00
WMDE-Fisch 66ecc1f0e7 Log edits in multiple sections that could trigger mentions.
This patch logs multiple section edits that could trigger mentions.

Since we only want to send mentions when userlinks and signature are present
in the same section a new method was added extracting sections and the related
content from an addition. The results are checked whether a section content
contains a signature and might be relevant for mentions.

Bug: T141863
Change-Id: Ib06cd855b2c7fbd51d8ab6602882cb38aadf8350
2016-08-18 14:58:00 +02:00
WMDE-Fisch c81e1b93d2 Fix mention failures not beeing sent.
While manual rebasing the bundle patch the wrong
line was removed.

Also improves tests to check for notifyAgent.

See I1069aeb5523db8710da4e8e21065bf447d031e3c

Change-Id: I33ddeccea153d6f6ae97e5c60e8b47dc24fb4833
2016-08-15 14:25:22 +02:00
WMDE-Fisch 272cb9a960 Bundle mention success and failure notifications
Adds common bundling including messages and icons.
Bundling relates to revision now.
Changed order how notifications are generated. Now errors will
show first, since they are generated last.

Bug: T140224
Change-Id: I1069aeb5523db8710da4e8e21065bf447d031e3c
2016-08-13 08:08:12 +00:00
addshore b5f0c435ec DiscussionParser stripSig from mention content
This will allow us to:
 1) Fix a bug involving showing the sig in the snippets
    of mentions (Something catrope mentioned to me but
    I do not know of a bug number for it)
 2) Send more accurate sameUser failure metrics to
    graphite as signature links would never be counted
    as a mention

Change-Id: I33677012673ae6e4665aaaf59d4f350602f7276a
2016-08-12 19:43:03 +00:00
jenkins-bot cf3e03edc9 Merge "Revert "Allow self mentions"" 2016-08-12 01:48:03 +00:00
Mattflaschen 59568789fa Revert "Allow self mentions"
This reverts commit 0e23463185.

Change-Id: I4389c7b93b2bbc117931a263b58a8f1cc30dca6c
2016-08-12 01:41:08 +00:00
jenkins-bot 189d84d01d Merge "Allow self mentions" 2016-08-04 22:53:54 +00:00
addshore 1880c683c2 Fix phpdoc in DiscussionParser::extractHeader
Change-Id: Ic92cea8fdcd0ccb6290204572b952d494554de3f
2016-08-03 13:31:09 +01:00
addshore 0e23463185 Allow self mentions
Bug: T138080
Change-Id: I8832f71559741787084bc06e1f7c5ea0f7918d82
2016-08-03 12:38:34 +01:00
WMDE-Fisch 78632108fd Echo notifications for successful mentions
Adds new notification type and icon for successful mentions.
Complements existing test to consider successful mentions.

Bug: T139623
Change-Id: I7a77b40e8b14c95cadb9023065ee916247feacf9
2016-08-01 13:40:55 +02:00
WMDE-Fisch 86d3352464 Refactored generation of mention events.
To increase reusability in future changes.

Change-Id: Ia56f4c587361f0214d738cdf690cf9abf93a2021
2016-07-29 14:49:09 +02:00
WMDE-Fisch 4c7e5d2669 Rename mention-too-many failure notification.
Change-Id: I49041bd01697ae4c160766f194c92ff3d7a4a989
2016-07-27 16:41:29 +00:00
WMDE-Fisch 868190bbf6 Echo notifications for mention failures
- Adds global "$wgEchoMentionStatusNotifications"
   to activate mention status notifications.
   (must be set before extension is loaded)
 - Adds notification types and icon for some basic mention
   failures.
 - Adds failure and stats for anonymous IP.
 - Adds check for links to user subpages.
 - Adds config var for max mention notifications allowed.
 - Bundles notifications.
 - Refactors test for the event generation and adds tests
   for unknown users, user links with subpages and failures
   for too many mentions.

Bug: T136326
Change-Id: I388bdc3714feb9a2865a5ad10dbeabb0a6a09a4f
2016-07-27 13:00:25 +02:00
jenkins-bot 414a1a189d Merge "Optimize DiscussionParser.php" 2016-07-19 22:10:35 +00:00
Leszek Manicki 6dcb872a7b Use StatsdDataFactory service instead of deprecated RequestContext method
Change-Id: Ie291146f67b525d891614c23b17052500fc8aa51
2016-07-15 18:03:47 +02:00
matejsuchanek d53e2cc75f Optimize DiscussionParser.php
Change-Id: I57c422d4c276062d4d55c9a8f580a22ef318f732
2016-07-13 17:31:06 +02:00
Stephane Bisson 23691d73d1 Mention notification: don't repeat the section title at the begining of the excerpt
Bug: T134922
Change-Id: I731ed9a7fafa7964aca776c543a58f6c5692f89a
2016-06-28 09:48:38 -04:00
addshore c1b4e4d5aa docs: Fix typo of 'begining' instead of 'beginning' in phpdoc
Change-Id: Ibc015f2133393788634d7e8b6119dcc305c6c534
2016-06-22 13:02:13 +00:00
WMDE-Fisch 3e9b2055b2 Clarify mention error log comment
The case also logs non-existing users.

Change-Id: Id5a360b672df11d214459432c4ebbed5c03c1ba9
2016-06-20 18:01:51 +02:00
Stephane Bisson d55396dee8 Try to extract an excerpt from a revision
Bug: T120152
Change-Id: I91abb2dded9ab7f124aaa798dd07c52576ee791b
2016-06-17 11:26:00 -04:00
addshore 6ad1abc171 Cleanup DiscussionParser
Change-Id: Ic37fac50455ac63e5388c2307d8b36cb9249ed1c
2016-05-31 17:01:32 -07:00
Roan Kattouw efa8846731 Use Revision::RAW when checking whether the author of a revision mentioned themselves
It's probably not realistically possible for a revision to be oversighted
by the time generateMentionEvents() runs, but for consistency
we should be using RAW here.

Change-Id: If73b4abe5fbae5cadb75c5e09137299873f2a764
2016-05-24 15:51:17 -07:00
addshore f51256845c Track why mentions didn't happen
Right now we don't actually know how many times
each of these cases happen so add some basic tracking
so we can make some informed decisions.

Bug: T135719
Change-Id: Id4d519aefe96ecca2e3c51dd1c8128de70d0caac
2016-05-24 15:47:05 -07:00
Kunal Mehta b6f742bc46 Add plain text email formatter
Formatters based on presentation models for
individual event emails and digest (daily, weekly)
plain text emails.

Bug: T121067
Change-Id: I4eceaf521315adab7429a8a73ffca70ebcddab86
2016-05-04 13:35:37 -04:00
Roan Kattouw 8b7e5dafe6 RevertedPresentationModel: Don't double-parse summary
formatSummary() was first parsing the summary using the
summary parser, then handing off the resulting HTML to
getTextSnippet() which parsed it again with the normal parser.

Bug: T131087
Change-Id: I2724ccb7c23579b3f02dea57d4fc833079169adf
2016-03-29 22:16:31 -04:00
Roan Kattouw 064a2cb5b8 Unconvolute DiscussionParser::getTextSnippet()
The previous implementation did the following weird things:
* Stripped tags before parsing
* Stripped templates before parsing using a hacky while loop
  that bails after ten attempts
* Decoded entities using htmlspecialchars_decode(), while
  html_entity_decode() makes more sense
* ...which meant it had to manually convert   back
  to spaces, which is not necessary if you use html_entity_decode()
* Removed any single braces ('{' and '}') from the output
* Rejected the entire output if there were any entities left,
  which is fairly likely since htmlspecialchars_decode()
  only decodes a few of them

Instead of all this, just parse, strip tags, decode entities
(all of them, not just a few), trim and truncate. In particular,
don't strip templates, because we use getTextSnippet() in mention
notifications, which look weird when {{ping}} templates are stripped.

Bug: T129531
Change-Id: I956b2f6badc40d2f5bf90a0458ccab8b8fc6fefb
2016-03-10 18:20:08 -08:00
Kunal Mehta dbc83a0c0c Unstub $wgLang before passing it to DiscussionParser::getTextSnippet()
getTextSnippet() has a `Language` type hint that will fatal if $wgLang
is a StubUserLang object, so make sure we unstub it if nothing else
already has.

Bug: T118542
Change-Id: I847680074fbbf95bbe3b6002151d2a18c45ebe6e
2015-11-16 10:41:51 -08:00
James D. Forrester 7f7e6b8159 build: Enable phpcs rule 'PSR2.Methods.MethodDeclaration.StaticBeforeVisibility' and make pass
Change-Id: Iff0709c3a30f8c39d54bab2361e109c96aea6aa0
2015-10-29 13:06:43 +01:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
Stephane Bisson 318182299a Add target-page to edit-user-talk to dismiss notification
Bug: T112477
Change-Id: I1f3de6b1d271a1245d581c5f6fb246ee23035fb5
2015-09-29 09:17:35 -04:00
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