Tjlsangria has uploaded a new change for review.

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

Change subject: Specify which revision was thanked in Special:Log/thanks
......................................................................

Specify which revision was thanked in Special:Log/thanks

Introduces config setting $wgThanksLoggingRevIds; if set to true,
will add to log_params "5::revid" and the revision ID

Bug: T51087
Change-Id: I95a69a48eab2b285e79e88fd6a91feac302f8e18
---
M ApiRevThank.php
M ApiThank.php
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks 
refs/changes/64/311364/1

diff --git a/ApiRevThank.php b/ApiRevThank.php
index febe356..f0a3974 100644
--- a/ApiRevThank.php
+++ b/ApiRevThank.php
@@ -99,7 +99,7 @@
                $user->getRequest()->setSessionData( 
"thanks-thanked-{$revision->getId()}", true );
                // Set success message
                $this->markResultSuccess( $recipient->getName() );
-               $this->logThanks( $user, $recipient, $uniqueId );
+               $this->logThanks( $user, $recipient, $uniqueId, 
$revision->getId() );
        }
 
        public function getAllowedParams() {
diff --git a/ApiThank.php b/ApiThank.php
index 67bf6e1..cb0bcdd 100644
--- a/ApiThank.php
+++ b/ApiThank.php
@@ -68,14 +68,19 @@
         * @param string $uniqueId A unique Id to identify the event being 
thanked for, to use
         *                         when checking for duplicate thanks
         */
-       protected function logThanks( User $user, User $recipient, $uniqueId ) {
-               global $wgThanksLogging;
+       protected function logThanks( User $user, User $recipient, $uniqueId, 
$revId = 0 ) {
+               global $wgThanksLogging, $wgThanksLoggingRevIds;
                if ( !$wgThanksLogging ) {
                        return;
                }
                $logEntry = new ManualLogEntry( 'thanks', 'thank' );
                $logEntry->setPerformer( $user );
                $logEntry->setRelations( [ 'thankid' => $uniqueId ] );
+               if ( $wgThanksLoggingRevIds && $revId ) {
+                       $logEntry->setParameters( [
+                               '5::revid' => $revId
+                       ] );
+               }
                $target = $recipient->getUserPage();
                $logEntry->setTarget( $target );
                $logId = $logEntry->insert();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95a69a48eab2b285e79e88fd6a91feac302f8e18
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Tjlsangria <tjlsang...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to