Commit graph

43 commits

Author SHA1 Message Date
Reedy 64ad66c8d4 s/@gropu/@group/
Change-Id: Ie407283a57e925a819e6365895153917e1ea3447
2018-06-04 07:29:04 +00:00
Kunal Mehta e696cba57f Add phan configuration
Change-Id: I6d0a0823404e5e50819ae0997b7d2c5267a4e144
2018-04-09 00:12:28 -07:00
Roan Kattouw 5f9f913fb6 ApiCoreThankIntegrationTest: Fix intermittent failures
Every time the setup function runs, it chooses a random page name with
random content. If it chooses a page name + content combination that was
used to set up a different test in the same run, the edit it makes will
be a null edit, the revid will be null, and the test will crash.

There are 100 possible page names and 100 possible page texts, so 10k
possibilities total, and the setup function appears to be called 10 times,
so the probability of a collision would have been
(10 choose 2)/10000 = 0.0045 = 0.45%, or one in every 222 times.

Bug: T151878
Change-Id: I800ee8512c2ad171ba793bea343f456653f9a16d
2018-03-19 18:03:27 -07:00
Max Semenik ed087b044c Reintroduce the API to thank for log entries
Originally introduced in b84eedc74e, it was reverted for security concerns.
New changes:
* Instead of bundling the log summary with notification, load it on display
* If the log event has been suppressed after the thanks for it has been sent,
  silently delete the event to prevent the confusion of linking to something
  zapped.
* Keep the 'already sent' cache key compatible with old format
* Validate the log id in the API
* Change ApiCoreThank::getRevisionFromParams() to ApiCoreThank::getRevisionFromId()

Bug: T186855
Bug: T188791
Depends-On: Ic5e9db0def857d9dcecbd06bf081c8c83712c1ea
Change-Id: I03aea7d9f4dfa0fe49639c53968deabf89999d2d
2018-03-06 13:08:47 +08:00
MaxSem 3b2397fea9 Revert "Add support to the Thanks API for thanking log entries"
This reverts commit b84eedc74e.

Bug: T188791
Change-Id: If55ed6cbb5da34c0034da3cc564c6a8ff82448d2
2018-03-02 22:59:20 +00:00
Sam Wilson b84eedc74e Add support to the Thanks API for thanking log entries
Add a 'log' API parameter (for the log ID to thank), and add
a whitelist config variable for specifying which log types are
thankable.

Bug: T186855
Change-Id: I58ae90c9729c0066f952e90fca2cf99b029d0d9b
2018-03-01 14:57:57 -08:00
Sam Wilson 78831d2b68 Rename files and classes in preparation for adding log-thanks
Bug: T186855
Change-Id: I20f5d200c33e395aca9489b73d0ed9b1d0ad5b8c
2018-02-21 12:49:21 +08:00
Sam Wilson 2e7e5e0190 Move classes to includes/ and rename some to match class names
For conformance to coding standards. This removes an exclusion
from the phpcs config.

Change-Id: I1481a3e7e68a81daf310ea3c7bf9dc48cdaf140b
2018-01-30 10:32:03 +08:00
Sam Wilson 55ceeb3fbe Fix member variable visbility and doc
Change-Id: I22d16b05d24c615f0c792063e33433d50a34ad8a
2018-01-19 16:38:58 +08:00
James D. Forrester 6bf8fd0b11 tests: Make compartible with QUnit 2
Change-Id: I726d7f75e37a759e1b1f6372710cb06f754fc94b
2017-10-23 13:38:11 -07:00
James D. Forrester e315e954a6 build: Replace jshint and jscs with eslint; drop csslint
Removing csslint rather than replacing it with stylelint as there
are no CSS or LESS files in this repo.

Also bumping banana and jsonlint to latest.

Change-Id: I9ffce273f63b061e07c3fa90ab4e82b5e551aa92
2017-08-03 17:24:34 -07:00
Kunal Mehta e2f4f28e3d build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* 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.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I6b5140bfdacab7a7ba23c7ba65e7e9f732c780a0
2017-06-25 13:54:10 +00:00
Brad Jorsch a9cbd9471b Update for API error i18n
See Iae0e2ce3. Since Thanks master requires core master, this just
depends on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: Ib6e66f7e94c41b7a27fe867f079626ac0ade4f1b
2016-11-15 03:22:14 +00:00
Brad Jorsch b40e7197e1 Prepare for API error i18n
This has the minimal changes necessary for unit tests to pass with
Iae0e2ce3.

Change-Id: I535344c29d51521147c2a26c341dae38cec3e931
2016-11-15 03:20:58 +00:00
Reedy b96f1a8b70 Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: Ic856aa0d3d7af53f1405ceee43aff41bface3b58
2016-08-05 17:40:28 +01:00
Stephane Bisson d4502c4c3a flow-thank: add a target-page entry for the topic page
The target-page entry allows locating those notifications
when the topic is moderated.

Bug: T93673
Change-Id: Ibe6bfda424b3ba2199efd712a5be194da4d5e6f2
2016-07-28 11:24:24 -04:00
Ori Livneh 9cb10b050e Update test for API change in PS10 of I17ef1f5197
Use $this->getMutableTestUser() instead of $this->getTestUser( true ).

Change-Id: Idb41b4842d0c95801dcd5476fa2f3e45153f9c71
2016-05-23 20:16:08 -07:00
Ori Livneh 111f48f982 Update tests for I17ef1f519
This is a prerequisite for I17ef1f519, since the tests break otherwise. The
change is backward-compatible since it checks for the presence of the
getTestUser method introduced by that change.

Change-Id: I8bbc9ebf32a89157fa9c60fd33151a10e7598af8
2016-05-24 02:38:12 +00:00
addshore 5c0b21593f Make revisions in setUp for ApiRevThankIntTest
Bug: T134582
Change-Id: I5317616f99f1344557fd818d0b00073a82197d05
2016-05-07 11:54:04 +00:00
addshore 6d470cad44 Rename ApiRevThankTest to reflect file name
Change-Id: I4b99e42999416643e17a8bcebe7bf00e70ca18ef
2016-05-06 15:23:30 +01:00
James D. Forrester 03b8f88fff build: Add doxygen, use composer for phpcs, make pass
Change-Id: I939d6f4d989cf21c0f817d262bf3e4acedcf2ffe
2016-04-25 15:42:04 +00:00
Kunal Mehta 9aa92841a6 Fix ApiRevThankTest::testValidRequest()
Bug: T130973
Change-Id: I3fc094fa0aeb7d5928fd8033bc3eefbceea72e16
2016-03-29 15:12:49 -07:00
addshore 57236b1809 @author Addshore everywhere for me
Change-Id: I424b8ba94a46d1ad430914aaf8d883af0df712a1
2016-01-27 11:06:17 +01:00
Glaisher 703642e40e Hide thanks button for botedits if bots are not allowed to receive thanks in mobile as well
Also only load 'ext.thanks.mobilediff' module if the recipient is not an IP.

Bug: T118686
Change-Id: I096d3b05a46590db426ae038f17f6e180fa5bf37
2015-11-24 22:47:56 +05:00
addshore 9b864432fd Remove use of deprecated TestUser->user
Change-Id: I10f1809b08a6c39685dc3af8088019483f307e6d
2015-08-11 01:27:50 +00:00
Matthias Mullie ddf1310eea Flow container needs to be reset before each test
Pimple throws an exception when overriding something that was
already fetched from container.
This is currently causing some extensions trouble.

To prevent shared state between tests the flow container 
needs to be reset in the setUp() routine of all tests
accesing the container.

Bug: T91967
Change-Id: Ic80b137e6ca2f8ba6ad34ce0bdbb1319b81c0a6e
2015-03-09 17:27:01 +00:00
jdlrobson e02c334880 Add tests for rendering of thanks button on mobile diff page
This has broken many times and I want this test to ensure its protection
in future.

Bug: T86687
Change-Id: Iea01c5c7c1ba00de47182521eeba86c8aef03522
2015-01-28 12:48:08 -08:00
Brad Jorsch a0e4ccfa30 Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-11-03 13:32:23 -08:00
jenkins-bot 160b5a3aab Merge "Repair thanks tests" 2014-09-18 23:44:34 +00:00
Erik Bernhardson a22b23287f Repair thanks tests
Change-Id: Ia0b34ece38ae219e5ee2c49b3d98490a503f536b
2014-09-16 13:27:58 -07:00
Matthias Mullie 2395bffdf9 Use board Title instead of topic Title
Since we've recently introduced a topic namespace, the notification looked like:
"Username thanked you for your comment in "Topic title" on Topic:UUID"

We want the board name instead of the link to the topic page, like:
"Username thanked you for your comment in "Topic title" on Talk:Boardname"

Change-Id: If45c01be3b0a9d67572932253a0103a2480fc823
2014-08-20 12:42:32 +02:00
wctaiwan dfb639af3e Call getAlphadecimal() directly
Relying on UUID::__toString() now triggers a notice, causing
unrelated patches to fail. This patch addresses the issue.

Change-Id: Ia94826a0e600adf8afd5908af75772b596ab8d0a
2014-04-15 03:54:00 +00:00
bsitu d9def310b3 Fix unit test in ApiFlowThankIntegrationTest.php
Looks like this is the only spot to fix for rev_type_id

Change-Id: Ie89b7d8090ca1c759f320d33d407fccdc7eb66c1
2014-04-15 01:44:51 +00:00
Erik Bernhardson 486ada0c56 PHPUnit mock builder doesnt accept leading \
Change-Id: Icab8d2475009604dd5b71ad816b5f959a8c7cc34
2014-04-08 00:01:54 +00:00
Benjamin Chen fbaed178a5 Add integration test for flowthank API
The test suite sets up various mocks for Flow classes and inserts
them into Flow\Container, so the API module retrieves the correct
mock classes instead.

Change-Id: I9c5e910e288f3dd72c66e68ca558265b8ca8ce5e
2014-03-14 19:16:11 +08:00
wctaiwan 98726b568b Add "Thanks" for comments on Flow boards
bug: 61930
Change-Id: Id37a14e3c75c63419fc34e0b7c2e21f74b3fa875
Co-authored-by: Bencmq <bencmqwiki@gmail.com>
2014-03-14 11:03:11 +00:00
addshore 4cdfa4e1f8 Add basic unit test for dieOnBadUser api method
Change-Id: Ic9fd4e63b0a7e3508c600f34decb8ce18abc1597
2014-01-24 13:13:25 -08:00
jenkins-bot 31437cf89d Merge "Add Special:Thanks as a non-JS fallback" 2013-12-19 05:43:11 +00:00
jenkins-bot 3573062156 Merge "Thanks is not using namespaces" 2013-12-06 08:00:55 +00:00
Kunal Mehta 06360b6d0d Add Special:Thanks as a non-JS fallback
If the user has JavaScript disabled, clicking
on "thank" will send the user to Special:Thanks
with the revision id already filled in. When
submitted, the form calls the API internally
and then shows the user an error or confirmation
message.

Special:Thanks is not a listed special page
since it's mainly intended as a fallback.

The API was modified to return the user name of the
editor who is being thanked if a new notification
was created.

Bug: 49161
Change-Id: I7ba4664b92bb0da425784350487ed0e7ca352b4e
2013-12-05 23:23:21 -08:00
theopolisme 72c0bf5d52 Perform checks before thanking via API
If the user attempts to thank an anonymous
user, a bot (when $wgThanksSendToBots is not true),
or him/herself, return an error. This is consistent
with the restrictions imposed in insertThankLink().

Bug: 56954
Change-Id: I9e8ae030a8ff1cc312bf98671e593c7367ca0ea2
2013-11-24 17:41:21 -06:00
Kunal Mehta 6240343103 Thanks is not using namespaces
Added in 422f0f6062

Change-Id: I8809348d30fdd8b569affd00cc061de22b38e6dc
2013-11-22 23:25:25 -08:00
addshore 422f0f6062 Add really basic API tests
This also includes the unit test hooks

Jenkings job will be added with I6ec2edf62b9

Change-Id: Id085db7096db420416e9fba72a65586d021f1c76
2013-11-04 16:38:23 +00:00