Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/111738

Change subject: Tag wikilove edits with a revision tag
......................................................................

Tag wikilove edits with a revision tag

Combined with EventLogging, should help us get rid of the
custom DB logging that WikiLove does

Bug: 60911
Change-Id: I3c77c1b47e22fd991bf6ceb8eace43517d8d611c
---
M ApiWikiLove.php
M WikiLove.hooks.php
M WikiLove.i18n.php
M WikiLove.php
4 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLove 
refs/changes/38/111738/1

diff --git a/ApiWikiLove.php b/ApiWikiLove.php
index e0a1fb0..9486271 100644
--- a/ApiWikiLove.php
+++ b/ApiWikiLove.php
@@ -61,6 +61,13 @@
 
                $api->execute();
 
+               $result = $api->getResult()->getData();
+
+               if ( isset( $result['edit'] ) ) {
+                       $revId = $result['edit']['newrevid'];
+                       ChangeTags::addTags( "wikilove", null, $revId );
+               }
+
                if ( isset( $params['email'] ) ) {
                        $this->emailUser( $talk, $strippedSubject, 
$params['email'], $params['token'] );
                }
diff --git a/WikiLove.hooks.php b/WikiLove.hooks.php
index d10b884..9180dc3 100644
--- a/WikiLove.hooks.php
+++ b/WikiLove.hooks.php
@@ -203,4 +203,16 @@
                        return wfMessage( 'wikilove-err-cannot-edit' )->plain();
                }
        }
+
+       /**
+        * ListDefinedTags hook handler
+        * @see https://www.mediawiki.org/wiki/Manual:Hooks/ListDefinedTags
+        * @param $tags
+        *
+        * @return bool
+        */
+       public static function onListDefinedTags( &$tags ) {
+               $tags[] = 'wikilove';
+               return true;
+       }
 }
diff --git a/WikiLove.i18n.php b/WikiLove.i18n.php
index d69d157..2c68de5 100644
--- a/WikiLove.i18n.php
+++ b/WikiLove.i18n.php
@@ -189,6 +189,7 @@
        'wikilove-terms' => 'By submitting, you agree to transparency under 
these $1.',
        'wikilove-terms-link' => 'terms',
        'wikilove-terms-url' => 
'http://wikimediafoundation.org/wiki/Feedback_privacy_statement',
+       'tag-wikilove-description' => 'Edit made using the WikiLove tool',
        'WikiLove.js' => '/* JavaScript placed here customizes WikiLove, see 
http://www.mediawiki.org/wiki/Extension:WikiLove#Custom_configuration */',
 );
 
@@ -278,6 +279,7 @@
 {{Identical|Term}}',
        'wikilove-terms-url' => '{{Optional}}
 This URL can be changed to point to a translated version of the page if it 
exists.',
+       'tag-wikilove-description' => 'Description for revision tag added when 
edit is made using WikiLove',
 );
 
 /** Afrikaans (Afrikaans)
diff --git a/WikiLove.php b/WikiLove.php
index a3c2d72..aff1c0d 100644
--- a/WikiLove.php
+++ b/WikiLove.php
@@ -70,6 +70,7 @@
 $wgHooks['BeforePageDisplay'][]                   = 
'WikiLoveHooks::beforePageDisplay';
 $wgHooks['LoadExtensionSchemaUpdates'][]          = 
'WikiLoveHooks::loadExtensionSchemaUpdates';
 $wgHooks['MakeGlobalVariablesScript'][]           = 
'WikiLoveHooks::makeGlobalVariablesScript';
+$wgHooks['ListDefinedTags'][]                     = 
'WikiLoveHooks::onListDefinedTags';
 
 // api modules
 $wgAPIModules['wikilove'] = 'ApiWikiLove';

-- 
To view, visit https://gerrit.wikimedia.org/r/111738
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c77c1b47e22fd991bf6ceb8eace43517d8d611c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLove
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to