summaryrefslogtreecommitdiff
path: root/Thanks
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2018-11-20 10:11:38 -0500
committerBrian Evans <grknight@gentoo.org>2018-11-20 10:11:38 -0500
commitb91beded3a01b2114d1da05d4c72a8482f38ffee (patch)
treedd8ada9107781e6d252eb305beb0e7dc36e6434e /Thanks
parentUpdate Echo to REL_1_30 (diff)
downloadextensions-b91beded3a01b2114d1da05d4c72a8482f38ffee.tar.gz
extensions-b91beded3a01b2114d1da05d4c72a8482f38ffee.tar.bz2
extensions-b91beded3a01b2114d1da05d4c72a8482f38ffee.zip
Thanks: Remove old files
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'Thanks')
-rw-r--r--Thanks/.csslintrc13
-rw-r--r--Thanks/.jscsrc4
-rw-r--r--Thanks/.jshintignore1
-rw-r--r--Thanks/.jshintrc10
-rw-r--r--Thanks/FlowThanksFormatter.php55
-rw-r--r--Thanks/ThankYou.pngbin468 -> 0 bytes
-rw-r--r--Thanks/Thanks.i18n.php35
-rw-r--r--Thanks/ThanksFormatter.php35
-rw-r--r--Thanks/tests/ApiFlowThankIntegrationTest.php230
-rw-r--r--Thanks/tests/ApiRevThankIntegrationTest.php78
-rw-r--r--Thanks/tests/ApiRevThankUnitTest.php81
11 files changed, 0 insertions, 542 deletions
diff --git a/Thanks/.csslintrc b/Thanks/.csslintrc
deleted file mode 100644
index ec188a93..00000000
--- a/Thanks/.csslintrc
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "adjoining-classes": false,
- "box-model": false,
- "box-sizing": false,
- "fallback-colors": false,
- "ids": false,
- "important": false,
- "outline-none": false,
- "overqualified-elements": false,
- "qualified-headings": false,
- "universal-selector": false,
- "unqualified-attributes": false
-}
diff --git a/Thanks/.jscsrc b/Thanks/.jscsrc
deleted file mode 100644
index dc37ba8e..00000000
--- a/Thanks/.jscsrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "preset": "wikimedia",
- "disallowDanglingUnderscores": null
-}
diff --git a/Thanks/.jshintignore b/Thanks/.jshintignore
deleted file mode 100644
index 3c3629e6..00000000
--- a/Thanks/.jshintignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/Thanks/.jshintrc b/Thanks/.jshintrc
deleted file mode 100644
index 2ca81330..00000000
--- a/Thanks/.jshintrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "predef": [
- "mediaWiki",
- "jQuery",
- "QUnit"
- ],
-
- "browser": true,
- "supernew": true
-}
diff --git a/Thanks/FlowThanksFormatter.php b/Thanks/FlowThanksFormatter.php
deleted file mode 100644
index feafed0a..00000000
--- a/Thanks/FlowThanksFormatter.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-class EchoFlowThanksFormatter extends EchoBasicFormatter {
-
- /**
- * @param $event EchoEvent
- * @param $param
- * @param $message Message
- * @param $user User
- */
- protected function processParam( $event, $param, $message, $user ) {
- if ( $param === 'postlink' ) {
- $this->setTitleLink(
- $event,
- $message,
- array(
- 'class' => 'mw-echo-diff',
- 'linkText' => $this->getMessage( 'notification-flow-thanks-post-link' )->text(),
- 'param' => array(
- 'workflow' => $event->getExtraParam( 'workflow' ),
- ),
- 'fragment' => "flow-post-{$event->getExtraParam( 'post-id' )}",
- )
- );
- } elseif ( $param === 'topictitle' ) {
- $message->params( $event->getExtraParam( 'topic-title' ) );
- } else {
- parent::processParam( $event, $param, $message, $user );
- }
- }
-
- /**
- * Overriding implementation in EchoBasicFormatter to support Flow posts
- *
- * @param EchoEvent $event
- * @param User $user The user receiving the notification
- * @param String $destination The destination type for the link, e.g. 'agent'
- * @return Array including target and query parameters
- */
- protected function getLinkParams( $event, $user, $destination ) {
- $target = null;
- $query = array();
-
- if ( $destination === 'post' ) {
- $target = $event->getTitle();
- if ( $target ) {
- $target->setFragment( '#flow-post-' . $event->getExtraParam( 'post-id' ) );
- $query['workflow'] = $event->getExtraParam( 'workflow' );
- }
- return array( $target, $query );
- } else {
- return parent::getLinkParams( $event, $user, $destination );
- }
- }
-}
diff --git a/Thanks/ThankYou.png b/Thanks/ThankYou.png
deleted file mode 100644
index 836147fe..00000000
--- a/Thanks/ThankYou.png
+++ /dev/null
Binary files differ
diff --git a/Thanks/Thanks.i18n.php b/Thanks/Thanks.i18n.php
deleted file mode 100644
index 24cb1563..00000000
--- a/Thanks/Thanks.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * This is a backwards-compatibility shim, generated by:
- * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShimcbebcf7f4e8bfd36' ) ) {
- function wfJsonI18nShimcbebcf7f4e8bfd36( $cache, $code, &$cachedData ) {
- $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
- foreach ( $codeSequence as $csCode ) {
- $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
- if ( is_readable( $fileName ) ) {
- $data = FormatJson::decode( file_get_contents( $fileName ), true );
- foreach ( array_keys( $data ) as $key ) {
- if ( $key === '' || $key[0] === '@' ) {
- unset( $data[$key] );
- }
- }
- $cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
- }
-
- $cachedData['deps'][] = new FileDependency( $fileName );
- }
- return true;
- }
-
- $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShimcbebcf7f4e8bfd36';
-}
diff --git a/Thanks/ThanksFormatter.php b/Thanks/ThanksFormatter.php
deleted file mode 100644
index a7a2aa3a..00000000
--- a/Thanks/ThanksFormatter.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-class EchoThanksFormatter extends EchoBasicFormatter {
-
- /**
- * @param $event EchoEvent
- * @param $param
- * @param $message Message
- * @param $user User
- */
- protected function processParam( $event, $param, $message, $user ) {
- if ( $param === 'difflink' ) {
- $eventData = $event->getExtra();
- if ( !isset( $eventData['revid'] ) ) {
- $message->params( '' );
- return;
- }
- $this->setTitleLink(
- $event,
- $message,
- array(
- 'class' => 'mw-echo-diff',
- 'linkText' => wfMessage( 'notification-thanks-diff-link' )->text(),
- 'param' => array(
- 'oldid' => $eventData['revid'],
- 'diff' => 'prev',
- )
- )
- );
-
- } else {
- parent::processParam( $event, $param, $message, $user );
- }
- }
-}
diff --git a/Thanks/tests/ApiFlowThankIntegrationTest.php b/Thanks/tests/ApiFlowThankIntegrationTest.php
deleted file mode 100644
index 21012b45..00000000
--- a/Thanks/tests/ApiFlowThankIntegrationTest.php
+++ /dev/null
@@ -1,230 +0,0 @@
-<?php
-
-use Flow\Model\AbstractRevision;
-use Flow\Model\PostRevision;
-use Flow\Model\UUID;
-
-/**
- * Integration tests for the Thanks Flow api module
- *
- * @covers ApiFlowThank
- *
- * @group Thanks
- * @gropu Database
- * @group medium
- * @group API
- * @group Flow
- *
- * @author Benjamin Chen
- */
-class ApiFlowThankTest extends ApiTestCase {
- /**
- * @var PostRevision
- */
- public
- $topic,
- $postByOtherUser,
- $postByMe;
-
- public function setUp() {
- parent::setUp();
-
- if ( !class_exists( 'FlowHooks' ) ) {
- $this->markTestSkipped( 'Flow is not installed' );
- }
-
- // mock topic and post
- $this->topic = $this->generateObject();
- $this->postByOtherUser = $this->generateObject( array(
- 'tree_orig_user_id' => self::$users[ 'uploader' ]->getUser()->getId(),
- 'tree_parent_id' => $this->topic->getPostId()->getBinary(),
- ), array(), 1 );
- $this->postByMe = $this->generateObject( array(
- 'tree_orig_user_id' => self::$users[ 'sysop' ]->getUser()->getId(),
- 'tree_parent_id' => $this->topic->getPostId()->getBinary(),
- ), array(), 1 );
-
- // Set up mock classes in Container.
- $mockLoader = $this->getMockBuilder( '\Flow\Repository\RootPostLoader' )
- ->disableOriginalConstructor()
- ->getMock();
- $that = $this;
- $mockLoader->expects( $this->any() )
- ->method( 'getWithRoot' )
- ->will( $this->returnCallback(
- // Hard to work with class variables or callbacks,
- // using anonymous function instead.
- function( $postId ) use ( $that ) {
- switch ( $postId ) {
- case $that->postByOtherUser->getPostId():
- return array(
- 'post' => $that->postByOtherUser,
- 'root' => $that->topic
- );
-
- case $that->postByMe->getPostId():
- return array(
- 'post' => $that->postByMe,
- 'root' => $that->topic
- );
-
- default:
- return array( 'post' => null );
- }
- }
- ) );
-
- $mockWorkflow = $this->getMock( '\Flow\Model\Workflow' );
- $mockWorkflow->expects( $this->any() )
- ->method( 'getOwnerTitle' )
- ->will( $this->returnValue( new Title() ));
-
- $mockStorage = $this->getMockBuilder( '\Flow\Data\ManagerGroup' )
- ->disableOriginalConstructor()
- ->getMock();
-
- $mockStorage->expects( $this->any() )
- ->method( 'get' )
- ->will( $this->returnValue( $mockWorkflow ) );
-
-
- $mockTemplating = $this->getMockBuilder( 'Flow\Templating' )
- ->disableOriginalConstructor()
- ->getMock();
-
- $mockTemplating->expects( $this->any() )
- ->method( 'getContent' )
- ->will( $this->returnValue( 'test content' ) );
-
- Flow\Container::reset();
- $container = Flow\Container::getContainer();
- $container[ 'loader.root_post' ] = $mockLoader;
- $container[ 'storage' ] = $mockStorage;
- $container[ 'templating' ] = $mockTemplating;
-
- $this->doLogin( 'sysop' );
- \DeferredUpdates::clearPendingUpdates();
- }
-
- public function testRequestWithoutToken(){
- $this->setExpectedException( 'UsageException', 'The token parameter must be set' );
- $this->doApiRequest( array(
- 'action' => 'flowthank',
- 'postid' => UUID::create( '42' )->getAlphadecimal(),
- ) );
- }
-
- public function testInvalidRequest(){
- $this->setExpectedException( 'UsageException', 'The postid parameter must be set' );
- $this->doApiRequestWithToken( array( 'action' => 'flowthank' ) );
- }
-
- public function testValidRequest(){
- list( $result,, ) = $this->doApiRequestWithToken( array(
- 'action' => 'flowthank',
- 'postid' => $this->postByOtherUser->getPostId()->getAlphadecimal(),
- ) );
- $this->assertSuccess( $result );
- }
-
- public function testRequestWithInvalidId(){
- $this->setExpectedException( 'UsageException', 'Post ID is invalid' );
- list( $result,, ) = $this->doApiRequestWithToken( array(
- 'action' => 'flowthank',
- 'postid' => UUID::create( '42' )->getAlphadecimal(),
- ) );
- }
-
- public function testRequestWithOwnId(){
- $this->setExpectedException( 'UsageException', 'You cannot thank yourself' );
- list( $result,, ) = $this->doApiRequestWithToken( array(
- 'action' => 'flowthank',
- 'postid' => $this->postByMe->getPostId()->getAlphadecimal(),
- ) );
- }
-
- protected function assertSuccess( $result ){
- $this->assertEquals( 1, $result[ 'result' ][ 'success' ] );
- }
-
-
- /**
- * This method is obtained from Flow/tests/PostRevisionTestCase.php
- *
- * Returns an array, representing flow_revision & flow_tree_revision db
- * columns.
- *
- * You can pass in arguments to override default data.
- * With no arguments tossed in, default data (resembling a newly-created
- * topic title) will be returned.
- *
- * @param array[optional] $row DB row data (only specify override columns)
- * @return array
- */
- protected function generateRow( array $row = array() ) {
- $uuidPost = UUID::create();
- $uuidRevision = UUID::create();
-
- $user = User::newFromName( 'UTSysop' );
- $userId = $user->getId();
- $userIp = null;
-
- return $row + array(
- // flow_revision
- 'rev_id' => $uuidRevision->getBinary(),
- 'rev_type' => 'post',
- 'rev_user_id' => $userId,
- 'rev_user_ip' => $userIp,
- 'rev_user_wiki' => wfWikiId(),
- 'rev_parent_id' => null,
- 'rev_flags' => 'html',
- 'rev_content' => 'test content',
- 'rev_change_type' => 'new-post',
- 'rev_mod_state' => AbstractRevision::MODERATED_NONE,
- 'rev_mod_user_id' => null,
- 'rev_mod_user_ip' => null,
- 'rev_mod_user_wiki' => null,
- 'rev_mod_timestamp' => null,
- 'rev_mod_reason' => null,
- 'rev_last_edit_id' => null,
- 'rev_edit_user_id' => null,
- 'rev_edit_user_ip' => null,
- 'rev_edit_user_wiki' => null,
-
- // flow_tree_revision
- 'tree_rev_descendant_id' => $uuidPost->getBinary(),
- 'rev_type_id' => $uuidPost->getBinary(),
- 'tree_rev_id' => $uuidRevision->getBinary(),
- 'tree_orig_create_time' => wfTimestampNow(),
- 'tree_orig_user_id' => $userId,
- 'tree_orig_user_ip' => $userIp,
- 'tree_orig_user_wiki' => wfWikiId(),
- 'tree_parent_id' => null,
- );
- }
-
- /**
- * This method is obtained from Flow/tests/PostRevisionTestCase.php
- *
- * Returns a PostRevision object.
- *
- * You can pass in arguments to override default data.
- * With no arguments tossed in, a default revision (resembling a newly-
- * created topic title) will be returned.
- *
- * @param array[optional] $row DB row data (only specify override columns)
- * @param array[optional] $children Array of child PostRevision objects
- * @param int[optional] $depth Depth of the PostRevision object
- * @return PostRevision
- */
- protected function generateObject( array $row = array(), $children = array(), $depth = 0 ) {
- $row = $this->generateRow( $row );
-
- $revision = PostRevision::fromStorageRow( $row );
- $revision->setChildren( $children );
- $revision->setDepth( $depth );
-
- return $revision;
- }
-
-}
diff --git a/Thanks/tests/ApiRevThankIntegrationTest.php b/Thanks/tests/ApiRevThankIntegrationTest.php
deleted file mode 100644
index 222fe658..00000000
--- a/Thanks/tests/ApiRevThankIntegrationTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * Integration tests for the Thanks API module
- *
- * @covers ApiRevThank
- *
- * @group Thanks
- * @group Database
- * @group medium
- * @group API
- *
- * @author Adam Shorland
- */
-class ApiRevThankTest extends ApiTestCase {
-
- public function setUp() {
- parent::setUp();
- $this->doLogin( 'sysop' );
- \DeferredUpdates::clearPendingUpdates();
- }
-
- public function testRequestWithoutToken(){
- $this->setExpectedException( 'UsageException', 'The token parameter must be set' );
- $this->doApiRequest( array(
- 'action' => 'thank',
- 'source' => 'someSource',
- 'rev' => 1,
- ) );
- }
-
- public function testValidRequest(){
- list( $result,, ) = $this->doApiRequestWithToken( array(
- 'action' => 'thank',
- 'rev' => $this->newRevId(),
- ) );
- $this->assertSuccess( $result );
- }
-
- public function testValidRequestWithSource(){
- list( $result,, ) = $this->doApiRequestWithToken( array(
- 'action' => 'thank',
- 'source' => 'someSource',
- 'rev' => $this->newRevId(),
- ) );
- $this->assertSuccess( $result );
- }
-
- protected function newRevId(){
- // You can't thank yourself, kind of hacky
- $this->setMwGlobals( 'wgUser', self::$users['uploader']->getUser() );
-
- /** @var Status $result */
- $result = $this->editPage( 'thanks' . rand( 0, 100 ), 'thanks' . rand( 0, 100 ), 'thanksSummary' );
- $result = $result->getValue();
- /** @var Revision $revision */
- $revision = $result['revision'];
-
- $this->setMwGlobals( 'wgUser', self::$users['sysop']->getUser() );
-
- return $revision->getId();
- }
-
- protected function assertSuccess( $result ){
- $this->assertEquals( array(
- 'result' => array(
- 'success' => 1,
- 'recipient' => self::$users['uploader']->username,
- ),
- ), $result );
- }
-
- public function testInvalidRequest(){
- $this->setExpectedException( 'UsageException' );
- $this->doApiRequestWithToken( array( 'action' => 'thank' ) );
- }
-
-}
diff --git a/Thanks/tests/ApiRevThankUnitTest.php b/Thanks/tests/ApiRevThankUnitTest.php
deleted file mode 100644
index d731053d..00000000
--- a/Thanks/tests/ApiRevThankUnitTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-/**
- * Unit tests for the Thanks API module
- *
- * @group Thanks
- * @group API
- *
- * @author Adam Shorland
- */
-class ApiRevThankUnitTest extends MediaWikiTestCase {
-
- static $moduleName = 'thank';
-
- protected function getModule() {
- return new ApiRevThank( new ApiMain(), self::$moduleName );
- }
-
- /**
- * @dataProvider provideDieOnBadUser
- * @covers ApiThank::dieOnBadUser
- */
- public function testDieOnBadUser( $user, $expectedError ) {
- $module = $this->getModule();
- $method = new ReflectionMethod( $module, 'dieOnBadUser' );
- $method->setAccessible( true );
-
- if( $expectedError ) {
- $this->setExpectedException( 'UsageException', $expectedError );
- }
-
- $method->invoke( $module, $user );
- //perhaps the method should return true.. For now we must do this
- $this->assertTrue( true );
- }
-
- public function provideDieOnBadUser() {
- $testCases = array();
-
- $mockUser = $this->getMock( 'User' );
- $mockUser->expects( $this->once() )
- ->method( 'isAnon' )
- ->will( $this->returnValue( true ) );
-
- $testCases[ 'anon' ] = array( $mockUser, 'Anonymous users cannot send thanks' );
-
- $mockUser = $this->getMock( 'User' );
- $mockUser->expects( $this->once() )
- ->method( 'isAnon' )
- ->will( $this->returnValue( false ) );
- $mockUser->expects( $this->once() )
- ->method( 'pingLimiter' )
- ->will( $this->returnValue( true ) );
-
- $testCases[ 'ping' ] = array( $mockUser, "You've exceeded your rate limit. Please wait some time and try again" );
-
- $mockUser = $this->getMock( 'User' );
- $mockUser->expects( $this->once() )
- ->method( 'isAnon' )
- ->will( $this->returnValue( false ) );
- $mockUser->expects( $this->once() )
- ->method( 'pingLimiter' )
- ->will( $this->returnValue( false ) );
- $mockUser->expects( $this->once() )
- ->method( 'isBlocked' )
- ->will( $this->returnValue( true ) );
-
- $testCases[ 'blocked' ] = array( $mockUser, 'You have been blocked from editing' );
-
- return $testCases;
- }
-
- //@todo test userAlreadySentThanksForRevision
- //@todo test getRevisionFromParams
- //@todo test getTitleFromRevision
- //@todo test getSourceFromParams
- //@todo test getUserIdFromRevision
- //@todo test markResultSuccess
- //@todo test sendThanks
-
-}