Commit graph

104 commits

Author SHA1 Message Date
Gergő Tisza 39ba452b32 Switch TestingAccessWrapper to librarized version
Bug: T163434
Change-Id: Ib5aeffb793cfd84201ca397a96689e0b81f3265f
Depends-On: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 11:34:57 +00:00
Leszek Manicki e45705fd84 Run MWEchoThankYouEditTest on clean DB tables
Other tests (possibly from other enabled extensions) could also,
by chance, create Echo notifications for the user MWEchoThankYouEditTests
uses. In order to those tests be reliable, they should make sure
there is no notification data in the database prior to running tests.

Bug: T161087
Change-Id: I870a50b1f831795731235fa8ec97477b3e470b50
2017-03-22 16:32:49 -04:00
WMDE-Fisch eb81a1c0f1 Avoid unintended mentions when changing content
When content is changed and the change contains the signature
of the user, the method checking for reasonable mentions in
that changes did not consider multiple signatures.

The patch fixes that and adds a test for it.

Bug: T154406
Change-Id: I86303f42e97d16c68e3235b0e2d13542ceedf1fe
2017-03-01 11:58:08 +00:00
jenkins-bot 387d0dc010 Merge "DiscussionParserTest only create users when needed" 2017-02-24 13:17:03 +00:00
WMDE-Fisch 71e3b66cc0 Remove test for internal diff engine acceptance
Since the internal diff engine is now always used this test
seems to be unnecessary.

Bug: T93625
Change-Id: I536474dc6231138293c9efc813a1bc2cc1e6f3b0
2017-02-24 11:32:37 +00:00
addshore 6d4021915f DiscussionParserTest only create users when needed
This speeds up the tests from 2 mins to 50 seconds for me.
(with a slow setup, no caching etc.)

Bug: T158120
Change-Id: I8adb6c8fe783d1be8841a1139bb141da3b046f9d
2017-02-24 11:10:22 +01:00
Umherirrender 3a72d87838 Remove unused DiscussionParser::stripIndents
Change-Id: I75fbcae70655c6db2873fd5e22d11a3c2cbf2f84
2017-02-22 18:05:07 +01:00
WMDE-Fisch d6f011aa1a Fix mentions failing editing empty pages
For the used diff engines an empty/new page is equivalent
to an empty line. When adding content that includes an
empty line the content will be split into two parts. The
interpreted diff will then consist of one addition, one
copied line and another addition.

Is the ping in the first addition and the signature in the
second addition the DiscussionParser does not send mentions.

The patch introduces a special case when interpreting diffs
if content is added to empty content. This will also skip
execution off diff engines since the interpretation is trivial.

Bug: T155998
Change-Id: Id5e44bc3245940c1f77c80f036db637756542552
2017-02-10 14:39:13 +00:00
Stephane Bisson 61b602e961 Fix unread notification count caching
Purge all cache when unread count changes and
repopulate on read.

Also fix client-side estimation when
marking a foreign notification as read.

Bug: T151389
Change-Id: I62def3d40a5640e26c234bb0335bc506dbf864a0
2016-12-09 09:23:59 -05: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
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
jenkins-bot 5fd9831c07 Merge "Send mentions when editing multiple sections in between sections." 2016-09-14 10:06:36 +00:00
Catrope bba984c002 Revert "Make seen/unseen badge more consistent across wikis"
Has bugs, and will likely cause deployment problems.
This'll need to be reverted in wmf.19 at least
until we fix it up.

This reverts commit 00e0b9f45d.

Change-Id: Ia9d220ebcb607f96dee6bc856755305ed8501fcc
2016-09-13 14:21:32 -07:00
Stephane Bisson b3c07eedeb Remove etp_user
Target page entries used to exist for each user
that was notified for an event. They were
removed as the notifications were marked as read.

Now they remain so that the association between
pages and events can be used for moderation
regardless of the notifications read status.

This patch removes everything about
echo_target_page.etp_user from sql and php code.

Bug: T143959
Change-Id: Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a
2016-09-09 09:32:28 -04:00
Moriel Schottlender 00e0b9f45d Make seen/unseen badge more consistent across wikis
- Add a 'hasUnseen' data to the xwiki bundle so the badge can
  consider its value when changing its color even without the
  bundle being opened.
- Check and store seenTimes from all sources that the xwiki
  has in a new JS object that the SeenTimeModel can store

Bug: T134855
Change-Id: Ifdcee88b4378cdc7acb4ae5c0cbc60b76339757e
2016-09-08 12:40:15 -07: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
Roan Kattouw fb1afa15e8 Fix call to irrelevant function in testFetchByUserOffset
testFetchByUserOffset should be testing fetchByUsreOffset(),
not fetchNewestByUserBundleHash().

Change-Id: Ie8c29714c4054999d14ebf0a3884912950be3837
2016-08-25 16:55:17 -07:00
Roan Kattouw ce3d6b2f49 Remove unused method EchoEventMapper::fetchByUserBundleHash
Bug: T143763
Change-Id: Iad63e8866eeccf316b3efe3a44888256c0c407d8
2016-08-23 19:22:01 -07:00
jenkins-bot f48b44bacd Merge "Log edits in multiple sections that could trigger mentions." 2016-08-19 22:00:43 +00:00
jenkins-bot d35c5825d8 Merge "Always use php based diff in EchoDiscussionParserTest" 2016-08-19 15:11:38 +00:00
addshore 5dd9858f4e Always use php based diff in EchoDiscussionParserTest
The previous check here meant that different
setups could run these tests with current diff
engines thus these tests could result in different
successes / failures.

Change-Id: I62a52dee1dd1ecd2ebd36e1aa540245e90a57ddd
2016-08-19 13:34:54 +01: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
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 8d21fb0c72 Merge "Prevent duplicate thank-you-edit notifications" 2016-08-05 22:09:23 +00:00
jenkins-bot 189d84d01d Merge "Allow self mentions" 2016-08-04 22:53:54 +00:00
addshore 61e9957a95 Add extra case to EchoDiscussionParserTest::testGetSectionCount
Change-Id: Iaec5b891df256955f3e24c8251e5f2e2881f469b
2016-08-04 00:20:22 +00:00
addshore b09cba54c2 Remove unused generateUserIdsForValidUserMentions in test
Change-Id: I78bdd6c9a0cb0ce823ca09379c8152c9c034c237
2016-08-03 17:17:36 -07:00
Stephane Bisson d18750b6fb Prevent duplicate thank-you-edit notifications
Avoid duplicate by looking if the notification
already exist.

Change-Id: Ie519d13cd0ab03919f70da90d58c82a214c74b49
Depends-On: I79194c41d6b2fd84ad658909a2941d9d3d28d94e
Bug: T128249
2016-08-03 14:49:23 -04:00
addshore 5ee7d74c6d Add test for EchoDiscussionParser::extractHeader
Change-Id: Ie4a05e58fafd9d852b2a27fe2ac8f2930b03d2f0
2016-08-03 18:01:57 +00:00
addshore 0e23463185 Allow self mentions
Bug: T138080
Change-Id: I8832f71559741787084bc06e1f7c5ea0f7918d82
2016-08-03 12:38:34 +01:00
WMDE-Fisch 547abe3bdb Add tests for events on multiple sections edits
Mainly as preparation for future patches touching that issue.

Change-Id: I80fd885cbf670e0e3252e38b85703c9d052b3056
2016-08-02 17:15:31 +02: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
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
Stephane Bisson 24caf50ff6 Dynamic bundles
To allow individual notifications to be
marked as read/unread or moderated,
bundles are created by grouping associated
notifications when they are fetched for display
instead of when they are created.

From a product perspective, this change doesn't
introduce moderation or expandable bundles but
it counts each individual notifications.
For instance, the bundled notification
"3 new topics on PageA" now counts as 3
notifications.

Bug: T93673
Bug: T120153
Change-Id: Iacd098573efd92bb1e3fcd7da4cd40cea9522f15
2016-06-27 09:49:13 -04:00
Roan Kattouw 99377e5525 Clean up and fix updateEchoSchemaForSuppression.php
This script was supposed to be run in production in 2013, but that
never happened. It was also never added to update.php.

* Use makeTitleSafe instead of newFromText, for correctness
* Fetch the columns that the update generator needs
* Replace wrapper for private method with closure
* Make the maintenance script logged

Bug: T136427
Bug: T50059
Change-Id: I6c2972120189f035483b5ca49610c008c4ba2c88
2016-06-06 23:56:28 +02:00
Ori Livneh 70bd4763e7 Include ApiEchoMarkReadTest in @Database group
This gets the database reset upon completion, which is needed for some reason I
can't quite locate. I17ef1f51 passes with this change.

Change-Id: I12759772001048a3be69a80adbb2572b7d9f0397
2016-05-23 16:12:02 -07:00
Stephane Bisson 6f6e10084c HTML email formatter using presentation model
Bug: T121067
Change-Id: I77f466f0b507ffa49a9714ddba95bea8db1d8438
2016-05-12 09:29:24 -04:00
Kunal Mehta 1a189964bc Reset the TitleParser service without messing up the database
Calling MediaWikiTestCase::setService() appears to mess up the database,
so just reset it directly with MediaWikiServices, and tear it down to
avoid leaking any state.

Change-Id: Ibfd0a7f98f50506cd8402f966682f320bf715c8a
2016-05-11 10:13:01 -07:00
Kunal Mehta 1baa72cf08 Reset TitleParser service after modifying $wgContLang
Needed by I81d48616afd1ab2bde1a5f1d12f4aefb1c866d43

Change-Id: Ic64b0c45b7e6b8420874385f952a0dc4a93e0149
2016-05-11 09:04:33 -07:00
Roan Kattouw 0807c3c5ad NotifUser: Refactor getNotificationCount() and friends, add caching for global counts
Previously, getNotificationCount() only looked at local notifications,
and foreign notifications were added in separately by getMessageCount()
and getAlertCount(). This didn't make any sense and resulted in
counter-intuitive things like I4d49b543.

Instead, add a $global flag to getNotificationCount(). If $global=false,
the local count is returned as before, but if $global=true, the
global count (=local+foreign) is returned. If $global is omitted,
the user's cross-wiki notification preference determines which is returned.

Update getLastUnreadNotificationCount() in the same way, since it had
the same issues.

Also add caching for global counts and timestamps, using a global
memc key.

Bug: T133623
Change-Id: If78bfc710acd91a075771b565cc99f4c302a104d
2016-05-02 16:16:57 -07:00
Matthew Flaschen 6d6845d9e4 Display special: Add which section (curr. Alert v. Msg.) each type's in
Replace getAlertEvents and getMessageEvents with
getEventsForSection.

Also, add IDs for linking to sections

Bug: T123018
Change-Id: Ic480320a52a401609d853fc8c75c781b89bb8722
2016-04-28 20:33:52 +00:00
jenkins-bot f6affc4655 Merge "BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical" 2016-04-23 02:27:40 +00:00
Matthew Flaschen 5ecc6aa7c8 BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical
Merge and deploy at the *same time* as:
* BounceHandler - I3c669945080d8e1f67880bd8a31af7f88a70904d
* mediawiki-config - I13817c139967ed9e230cfb0c87c5de66da793c96

Despite claiming to be about categories, $wgEchoDefaultNotificationTypes
was actually configuring both categories and types (which go inside
categories).

For example, 'thank-you-edit' is a type, but 'emailuser' is both
a category and a type (when used as a category, this has special
effects at Special:Preferences).

Since types and categories can and sometimes do have the same names,
this leaves no way to properly and clearly configure them.  It also
makes it difficult to document what is going on (as required by
T132127).

Split into three variables:

$wgDefaultNotifyTypeAvailability - Applies unless overriden

$wgNotifyTypeAvailabilityByCategory - By category; this can be and is
displayed at Special:Preferences

$wgNotifyTypeAvailabilityByNotificationType - By type; this cannot
be displayed at Special:Preferences. To avoid confusing the user,
we introduce a restriction (which was previously followed in practice,
AFAICT) that types can only be overridden if the category is not
displayed in preferences.

Otherwise, it can look to the user like a category is on/off, but the
types within might have the opposite state.

Due to this configuration change, this is a breaking change, and needs
coordinated deployments.

This also lays the groundwork for T132127

Also change terminology to consistently use "notify type" for web/email.

It was mixing between that and output format (which unfortunately
sounds like the API format, e.g. 'model').

Bug: T132820
Bug: T132127
Change-Id: I09f39f5fc5f13f3253af9f7819bca81f1601da93
2016-04-22 19:08:12 -07:00