jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/332719 )

Change subject: Fix comment blocking
......................................................................


Fix comment blocking

The blockUser() method wasn't declared as static but it was used as such,
which meant that calling $this->getUser() failed; it would have failed
anyway because the CommentFunctions class isn't a ContextSource and
doesn't implement a getUser() method in the first place.

HT SamanthaNguyen

Change-Id: I723ddbd41e00382622dd8f2c93ca395952e8fc88
---
M CommentFunctions.php
M api/CommentBlock.api.php
2 files changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Jack Phoenix: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CommentFunctions.php b/CommentFunctions.php
index 87fa364..2c16ccd 100644
--- a/CommentFunctions.php
+++ b/CommentFunctions.php
@@ -141,10 +141,11 @@
        /**
         * Blocks comments from a user
         *
+        * @param User $blocker The user who is blocking someone else's comments
         * @param int $userId User ID of the guy whose comments we want to block
         * @param mixed $userName User name of the same guy
         */
-       public function blockUser( $userId, $userName ) {
+       public static function blockUser( $blocker, $userId, $userName ) {
                $dbw = wfGetDB( DB_MASTER );
 
                wfSuppressWarnings(); // E_STRICT bitching
@@ -153,8 +154,8 @@
                $dbw->insert(
                        'Comments_block',
                        array(
-                               'cb_user_id' => $this->getUser()->getId(),
-                               'cb_user_name' => $this->getUser()->getName(),
+                               'cb_user_id' => $blocker->getId(),
+                               'cb_user_name' => $blocker->getName(),
                                'cb_user_id_blocked' => $userId,
                                'cb_user_name_blocked' => $userName,
                                'cb_date' => $date
diff --git a/api/CommentBlock.api.php b/api/CommentBlock.api.php
index 867027d..de84316 100644
--- a/api/CommentBlock.api.php
+++ b/api/CommentBlock.api.php
@@ -21,7 +21,7 @@
                        $username = $s->comment_username;
                }
 
-               CommentFunctions::blockUser( $userID, $username );
+               CommentFunctions::blockUser( $this->getUser(), $userID, 
$username );
 
                if ( class_exists( 'UserStatsTrack' ) ) {
                        $stats = new UserStatsTrack( $userID, $username );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I723ddbd41e00382622dd8f2c93ca395952e8fc88
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Comments
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: UltrasonicNXT <adamr_car...@btinternet.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to