Commit graph

58 commits

Author SHA1 Message Date
jenkins-bot 42fd16e0f3 Merge "Update for MessageCache as a service" 2019-08-19 15:36:45 +00:00
Aryeh Gregor 7290434158 Update for MessageCache as a service
Change-Id: I546eda0377f3a50843144b1450d3fbe8e4e02a8a
2019-08-18 11:46:11 +03:00
Dayllan Maza b3df45dc34 Add option to mute/unmute notifications on Special:Mute
The hook (SpecialMuteModifyFormFields) is used to append
the option to mute/unmute echo notifications from a specified user.

Special:Mute handles posting and saving the fields, the only
requirement is that the field name is the same as the property
that wants to be modified, in this case 'echo-notifications-blacklist'

Bug: T220163
Depends-On: I2b3eee0802cb086091f35ecce13ae77a8e7d518d
Change-Id: I77b3ccfdce9b501eb8ecd58c0d7bbecb78029a7e
2019-07-18 15:47:24 +00:00
Derick Alangi 8e5aa13a73 Remove usage of deprecated Revision class in Echo
Class Revision is deprecated and in this patch, replaces
usage with appropriate classes; RevisionRecord, RevisionStore,
etc.

Bug: T221163
Change-Id: Icfc85167a636bef95daab236ab80113c1a3cf41b
2019-05-08 19:50:58 +01:00
Kosta Harlan ffa887bd34 Re-enable DiscussionParser tests
These work now that I4c0d629da254ac2aaf31aae35bd2efc7bc064ac6 is merged.

Bug: T194632
Bug: T218388
Change-Id: If8031d488a67c423c7d4f4d3bf0f5e4126d3212a
2019-03-27 17:38:01 -04:00
Kosta Harlan c2c9ed0926 Disable DiscussionParserTest until we can figure out why it broke
Bug: T218388
Change-Id: I5cee1784ea6d89d8ecc51a055631a30c408af6be
2019-03-15 14:45:23 -04:00
Kosta Harlan 84d3f8b00c Remove problematic test case
Note, per T194632#5018823 it appears that replacing instances of
Benutzer:Schnark with User:Schnark cause the test to pass, so we should re-add
this test case once we've figure out why that's happening.

Bug: T194632
Change-Id: I8000c037c515283e46d4b530f8d91bdef35c7ace
2019-03-12 14:44:17 -04:00
Thiemo Kreuz c36d2bd0e8 Prefer the …::class feature over hard-coded strings in all tests
The codebase already used the …::class feature in many places. So this
is more for consistency than anything. The …::class feature makes it
much easier to do refactoring in the future.

Note this patch is exclusively touching tests. That should make it
relatively easy to review this. As long as the CI is fine with it, it
should be ok. Right? ;-)

Change-Id: I4d2adee76b4adbc83b2061161fd4e863ba833fcb
2019-02-19 14:35:14 +00:00
Roan Kattouw de536d09d9 Make notifyAgent a per-type property rather than per-event
Specify which notification types allow notifying the event agent in
$wgEchoNotifications, and stop specifying it in the event_extra data.

Putting 'notifyAgent' => true in event_extra will still work, but is
discouraged.

Change-Id: I4f558654ec23757dd4ecd6986eb3e9a5593f5386
2018-10-29 15:41:51 -07:00
daniel c06ca6d111 Test data providers should never access the database.
Any database access in test providers is hitting the live
database, not the test mock!

Change-Id: I01d8c41ed30cfaf68642c218090147ac39757c5e
2018-09-07 01:24:52 +00:00
Umherirrender 2cd8d9d0eb Split long lines over 140 chars
This makes the code easier to read even on big screens

Change-Id: I14bfb97b2986f389ad11a6ddc97ba61468774782
2018-08-25 12:51:14 +02:00
Umherirrender a0ad95b63f Split long lines over 200 chars
This makes the code easier to read even on big screens

Change-Id: Iebc2ca785690abc6e7998c6f6078daf0bd01ccf8
2018-08-23 10:33:25 +02:00
Thiemo Kreuz c1c3c7b672 Make "@… array" type hints more specific
There are about 200 of such generic "array" type hints in this code base,
the majority in @param tags. I started with what I found most relevant:
@var and @return tags. I might continue working on this later, but
wanted to stop for now to keep this patch moderately small.

Change-Id: Iff0d9590a794ae0f885466ef6bb336b0b42a6cd3
2018-08-13 09:27:37 +02:00
Aryeh Gregor 83be57fe01 Use setContentLang instead of setMwGlobals
This sets $wgLanguageCode appropriately.  It will also be necessary when
$wgContLang becomes a service, in which case setting the global directly
will not work correctly.

Bug: T200246
Change-Id: I4aaf1c641ec6abef214eb96c0e4b42a67488ac00
2018-07-25 19:12:09 +03:00
jenkins-bot d814e9c4bf Merge "Ping users mentioned in edit summaries" 2018-02-23 18:44:46 +00:00
Max Semenik 467b13fe89 Ping users mentioned in edit summaries
Disabled by default for now.

Bug: T32750
Change-Id: I8012b82b6e27cc2612fb2302d0c9feb3f3623d62
2018-02-22 12:37:35 -08:00
addshore 1bb986c407 Use overrideMwServices in DiscussionParserTest
Bug: T135023
Change-Id: Ibcef80224c998239f57a9353fa97ba6129fc53b1
2018-02-01 16:14:59 +00:00
Kunal Mehta 59a125fc38 Add @covers tags
Change-Id: Ib8cf432b58470c9218519639379c83254acef1c8
2018-01-23 16:44:45 -08:00
Amir Sarabadani 30a5b88ea1 Use ExtensionRegistry instead of class_exists
Bug: T183096
Change-Id: I963704cdcfdbc97727f435eb16998c16c692ed01
2017-12-29 00:12:30 +01:00
Kunal Mehta 9095d5bcb5 Use namespaced ScopedCallback
The non-namespaced version is deprecated since 1.28

Change-Id: Iac0b120ccda77065a480e9461e7fcbd19d55f1db
2017-08-21 14:05:11 -07:00
MusikAnimal fdd1fe6d22 Duplicate new table from core, patch 349457
With 349457, anytime a revision is created, a corresponding record
is created in the new ip_changes table. This may cause tests to fail
if they don't drop the ip_changes table between individual tests.

https://gerrit.wikimedia.org/r/#/c/349457/

Change-Id: I48f0b64f19f9582b40540fa1b42a39d281979625
2017-08-11 15:51:03 -04: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
Gergő Tisza 39ba452b32 Switch TestingAccessWrapper to librarized version
Bug: T163434
Change-Id: Ib5aeffb793cfd84201ca397a96689e0b81f3265f
Depends-On: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 11:34:57 +00: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
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
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 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 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
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