Commit graph

207 commits

Author SHA1 Message Date
Roan Kattouw abff3f780d Replace EchoDiscussionParser::htmlToText with Sanitizer::stripAllTags()
The latter doesn't trim(), so add trim() calls in some cases.
User input is trimmed, parsed i18n messages are not.

Change-Id: I933a6a929bf7d3e2d1623ea537227dc8c731cb6f
2017-07-07 16:55:51 -07:00
Ela a4974ef1e1 Adding the first step in order to enable the visualization of the Article Reminder feature.
Includes feature flag, presentation model.
Temporarly hooks to new user creation.

Bug: T165755
Bug: T165754
Change-Id: Ic0a2ca07b0cd1597e5534bb1f3b748beb215ddfc
2017-06-30 19:45:24 +03:00
Kunal Mehta aaf061c725 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ExtraParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I8401abf121a7413fa191d7bc535e0ddd6cf8c3f7
2017-06-22 14:13:28 +00:00
Matthew Flaschen 24a055c946 Correct license to MIT
This extension overall is under MIT, per Echo.php, extension.json,
and COPYING.

Change-Id: I39d533b671bb9eff3ba2e9faf5fcf482374b8e61
2017-06-20 20:32:39 -04:00
Max Semenik 5003262d77 Don't use deprecated class
Change-Id: I76ad6b8cafb4fcf2f1f2ce32537a5314a66b64a0
2017-05-05 11:51:04 -07:00
jenkins-bot f19d9156a2 Merge "Fix counting of bundled mention notifications" 2017-05-03 10:53:54 +00:00
WMDE-Fisch 620855d770 Fix counting of bundled mention notifications
This patch will fix the notification counts in bundled mention notification
messages. The former method did not work at all due to false assumptions
what the getBundleCount method can be used for.

Since this is in the presentation only wrong messages should be fixed when
deployed

Bug: T164115
Change-Id: If316549a090c2d281a8d612e4985fd556eabc807
2017-05-03 10:40:40 +02:00
Stephane Bisson dd77a46c1b MentionStatus: prefer failure-type
In MentionStatusPresentationModel, prefer
extra['failure-type'] to event-type to determine
why the mention was not sent.

Bug: T144614
Change-Id: Id3b55e15a0c1a8f3fee19cbe07983c6e373b309e
2017-04-20 12:21:02 -04:00
This, that and the other 3f99672d5e Add proper message when user group expiry is changed
There's a lot more that could be done to improve user "rights"
notifications (really user group notifications), but this will do for now.

Bug: T159301
Depends-On: I5d32445f8e5b41599889b8488a2431e7a908f858
Change-Id: I27d52bc5c39219c832bf63a491faa1e421b0c024
2017-04-10 11:38:49 -07:00
Leszek Manicki c205cd85d3 Document return value EchoEventPresentationModel:getTruncatedX methods
Change-Id: Ic3416bc07bb2f47ff6800ab0de86ee7b23a7cc2e
2017-01-30 11:54:55 +01:00
Justin Du 67f926707e Add GENDER support to a few Echo messages
* echo-email-plain-footer
* echo-email-html-footer-preference-link-text
* echo-email-html-footer-with-link

Bug: T145439
Change-Id: I2d55a617910efa11effef1a469e6d845eebc5591
2016-12-28 10:43:40 -06: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
Amir Sarabadani 047b92e4c6 Align Email format with Wikimedia color palette
For Wikimedia color palette see: https://phabricator.wikimedia.org/M82

Change-Id: I6782148e94f4896397f93295ab44760c02556e25
2016-11-28 00:50:46 +03:30
jenkins-bot e888d95f1e Merge "Used parsed section titles for anchors" 2016-09-28 14:46:47 +00:00
Roan Kattouw 6eea6d93a1 Used parsed section titles for anchors
This allows us to link to the right section when the section
title contains templates or magic words.

* Add getParsedSectionTitle()
* Use it in getTitleWithSection()
** Stop using Parser::guessSectionNameFromWikiText() because it
   wants preprocessed wikitext, not fully parsed and stripped text
* Move getTruncatedSectionTitle() from EventPresentationModel to
  PresentationModelSectionTrait and make it use getParsedSectionTitle()

Bug: T134216
Change-Id: I877ff6b0ce4e64400f6e5f6284ae47a11cd4335b
2016-09-27 16:17:59 -07:00
jenkins-bot faf3bee07c Merge "Fix links to sections with [[links]] in their title" 2016-09-27 19:53:33 +00:00
Kavitha Muthu a518044bb3 Make user rights notifications link to added/removed group
This change was made to direct users to the added/removed group.
Notification about the change in the user's right will route the user
to a page about the group.

Bug: T55860
Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
2016-09-27 03:53:53 +00:00
Roan Kattouw 229db67347 Fix links to sections with [[links]] in their title
We would generate things like #Foo_.5B.5Bbar.5D.5D
instead of #Foo_bar . Unfortunately this doesn't
fix section titles with templates / magic words
in them, because those are parsed at notification render
time instead of at notification generation time.

Bug: T134216
Change-Id: Ia171324a4a616c956ab08fcff38293f18dc765fa
2016-09-26 17:16:24 -07:00
Moriel Schottlender 58c53af1d1 Remove primary link from the bundle of page linked notification
Also, make sure that the bundle follows the same behavior as the
xwiki bundle, where if it does not have a primary link, the 'click'
event triggers the 'expand' action.

Bug: T145902
Change-Id: I456bf76a7bd531ffcad5462708f37cd54d8af99d
2016-09-19 14:16:43 -07:00
Matthew Flaschen f2327a919b Fix GENDER without explicit parameter
Although we generally use getViewingUserForGender, these messages
are UI and in user language, so we should change the flag anyway.

getViewingUserForGender is essential for messages that are used
in batch jobs.  Some messages technically don't require it, though
it's probably best to be consistent anyway.

Bug: T144538
Change-Id: I7b57777ab93b5752165c7bdd85fa5ce66b294b22
2016-09-14 16:39:49 -04:00
Moriel Schottlender cc36178e4a Add {{GENDER}} support to dynamic action messages
Make sure we pass the current user to the message, since empty
{{GENDER:|}} doesn't seem to work in PHP.

- Add parameter to documentation
- Add {{GENDER}} syntax to en.json as example
- Add parameter to the message creation

Bug: T144538
Change-Id: Ifc5e3bbe8309cc9ce120b7d61cdc050d7055aacc
2016-09-12 15:30:29 -07:00
jenkins-bot 7f24836607 Merge "Make PresentationModel::getPrimaryLinkWithMarkAsRead() final" 2016-09-12 13:28:05 +00:00
Kunal Mehta 7051cfb2a5 Make PresentationModel::getPrimaryLinkWithMarkAsRead() final
Subclasses should not override this. Also fix the return type phpdoc of
getNotificationCountForOutput().

Change-Id: Ia6963794d3a68dca742fe52ac197edf1575bed76
2016-09-11 12:46:08 -07:00
Sébastien Santoro ad0cf6cda0 Fix MentionStatusPresentationModel::getSecondaryLinks return value
Any class implementing EchoEventPresentationModel and overriding the
getSecondaryLinks method should return an array (while getPrimaryLink
could return a false boolean value).

This change fixes the following errors:

Warning: array_values() expects parameter 1 to be an array or collection
in …/extensions/Echo/includes/formatters/EventPresentationModel.php on line 494

Warning: array_filter() expects parameter 1 to be an array or collection
in …/extensions/Echo/includes/formatters/EventPresentationModel.php on line 494

This is a follow-up for commit b4b59ee4.

Bug: T145229
Change-Id: Ic66ca03b6979472495c9b748093d01f8f097d56a
2016-09-09 19:59:09 +00:00
Moriel Schottlender 59c0ad6c4d Make 'Edit threshhold' notif appear regardless of title existence
If a user recieves 'this is your X edit' they should get this notif
regardless of whether the edit they created was deleted. We should
make sure the title is there only for deciding whether or not to
create a link for it; otherwise, the notification will just appear
without a link to the revision.

Change-Id: I00ed4278bb4e15b1e9ddfa2c3af8fad0540fc5f8
2016-09-08 23:01:47 +00:00
Moriel Schottlender eb98b21dfe Add 'canRender' check to EchoMentionStatusPresentationModel
Change-Id: Ica338ff5810b62849d30e5b27709558f1b797c43
2016-09-06 14:44:51 -07:00
Stephane Bisson c75d974004 Provide title when parsing wikitext
Bug: T141460
Change-Id: I802c9c4bf964a060e44f25a487b5aec6f7d8c6b6
2016-09-01 16:48:56 -04:00
Moriel Schottlender a0e02da71f Style changes for unwatch actions
- Reverse 'watch' / 'unwatch' star icons
- Truncate title texts
- Minor indentation fix

Bug: T132975
Change-Id: I1dbd6d1480f6ef5a45184271c932cd27258f7424
2016-08-26 14:58:10 -07:00
Matthew Flaschen 299b66f937 Dynamic actions: Reuse label/description for those fields
This is necessary to preserve backwards compatibility for the API, and
this also fixes the no-JS special page.

Also, fix additional warnings.

Change-Id: Id603b4ab22c69097d5559a756bec72a6ba785661
2016-08-25 22:00:25 -04:00
jenkins-bot 4e99a5095f Merge "Add dynamic secondary actions to notification items" 2016-08-23 17:43:08 +00:00
Moriel Schottlender 480ce92bd8 Add dynamic secondary actions to notification items
Allow extensions to add dynamic actions that perform some
API request and display a confirmation message.

Bug: T132975
Change-Id: Ib16d57c3f1a11a9749564c6e2112bf1ca32c55e8
2016-08-22 16:04:48 -07:00
jenkins-bot 435fe70fe0 Merge "Add a rasterized email icons to Echo modules for email" 2016-08-16 23:27:04 +00:00
Moriel Schottlender 5fefbe4b03 Add a rasterized email icons to Echo modules for email
Make sure we send rasterized png emails instead of SVGs in the
email formatter.

Bug: T127794
Change-Id: Ia28757bda521ec182f75458c8e52d54847d15681
2016-08-16 00:21:13 +00: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
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
WMDE-Fisch b4b59ee485 Remove secondary link in bundled messages for mention status notifications
Change-Id: I76de1626c77831b09fe3bb410d17ce354783076a
2016-08-03 18:22:04 +00: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 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
Stephane Bisson a77d75c3ee Documentation for EventPresentationModel
Change-Id: Ia620bd1a2a562c606752195cb459dc46d41db7b2
2016-07-21 12:25:46 -04:00
Stephane Bisson cf71009638 Remove deprecated formatter
Followup to I639b9d9906d3ff37021cb9b5ed3cb401354b5bd9

* Remove deprecated formatter
* Log a warning and fail gracefully
  when an event type does not support
  Echo presentation model.

Bug: T121612
Change-Id: Ic5712c4ce265b6faabce7a4028b4294fe3c73f18
2016-07-20 11:00:34 -04:00
Stephane Bisson 2f0ff9cbf6 Cleanup old notification formatting system
* Deprecated main entry-points
* Removed unused configuration
* Removed old formatters for Echo events (mention, edit-user-talk, etc)
* Removed unused messages

Bug: T121612
Change-Id: I639b9d9906d3ff37021cb9b5ed3cb401354b5bd9
2016-07-11 16:57:14 +00:00
Moriel Schottlender 7879f0c9f8 Change 'messages' to 'notices' throughout the interface
Bug: T139520
Change-Id: Ib7f4dc4ea1ff4c5d1fccdc5fdf0c66b049162cb2
2016-07-07 15:57:49 -07:00
Stephane Bisson ebd616d6f3 compact-header should be parse because it includes formatting
Bug: T139602
Change-Id: I3c9fd6cd6b5b805b7867de6ee2cb3555a5d0d123
2016-07-07 13:16:26 -04:00
Stephane Bisson db838e42ce Keep bundled notification compact header on one line
Bug: T139321
Change-Id: I4b0a7173bc06a0760efff544bcc28a59ba72ce7f
2016-07-06 20:44:00 +00:00
Stephane Bisson f8a8d392d6 Expandable bundle
Support bundles being expandable
to show their sub-notifications.

Bug: T114356
Change-Id: I1507cae360f45cc87f2d60e966b4d047abfa202d
2016-06-28 15:37:54 -04:00
jenkins-bot 731cde01b8 Merge "Dynamic bundles" 2016-06-28 19:34:42 +00:00