Commit graph

257 commits

Author SHA1 Message Date
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 3e3c82a167 Use fake timer in Echo unit tests
Freeze time to avoid a race condition
where a second is ticking in the middle
of a unit test.

Bug: T154188
Change-Id: I6b0c8ae06360e6da016d97361cc2ccdeaf2e4343
2017-01-04 16:43:55 -05: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
Ed Sanders c8d24ebd17 build: Replace jscs/jshint with eslint
Change-Id: Iee1d1b20ed31e636bfb8fc8cf9b18ff328bf608c
2016-11-23 15:25:59 -08:00
Moriel Schottlender 7b4bb11c2a Add proper QUnit tests
Change-Id: I7a4abf068a32d9cf65eb464eb036f72f319c54ff
2016-09-29 15:28:30 -07:00
Moriel Schottlender 2875e3e5dd UnreadNotificationCounter should always normalize the count
Whether we estimate or not, the actual stored count should always be
normalized within the range of 0-cap. Estimation should always skip if
the current count is at the cap; in that case, the count can only be
changed when we get the value from the API through setCount() (used
when the value is known, rather than estimated.)

Change-Id: Ie8b81a4433e8254ee0e90f59e5b25d727158eecf
2016-09-23 16:22:56 -07: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
Stephane Bisson f3874126b9 Browser tests: update to mw-selenium 1.7.2 and https
Bug: T129483
Change-Id: Id33398d0615da77be0136f8680e56edc13f4e635
2016-08-11 15:47:42 -04: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
jenkins-bot 5f04fc334c Merge "Redo the notification badges" 2016-07-29 22:53:34 +00: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
Moriel Schottlender 9ab351352f Redo the notification badges
Bug: T115845
Bug: T140900
Depends-On: Ic666540d70de52f
Change-Id: I34e2736490319989a3a251a43fbe8080ab960b00
2016-07-27 11:51:05 -07:00
WMDE-Fisch 4c7e5d2669 Rename mention-too-many failure notification.
Change-Id: I49041bd01697ae4c160766f194c92ff3d7a4a989
2016-07-27 16:41:29 +00:00
jenkins-bot 0815c41560 Merge "Echo notifications for mention failures" 2016-07-27 11:27:55 +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 69f5f0d39a Browser tests: update local url
Change-Id: I9284acd37bfba51a53ddc1385eaad626e5592fa0
2016-07-25 15:52:58 -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
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