jenkins-bot has submitted this change and it was merged.

Change subject: Correctly nest comments.
......................................................................


Correctly nest comments.

Fixes bug #46636.

This was caused by 817a74bc3792f409c9b66eac9a894ef6777c24b5, where
commentData()'s middle parameter ($review) was removed, but the call to
commentData() in saveComment() was not updated accordingly.

Based on my very limited tests, $review seems to be 0 always, whereas
$parent is the parent comment's ID when we're replying to a comment.
Because the parameter order was changed when one parameter was removed,
$review unintentionally became the new $parent, and as a result, all
comments were treated as new top-level comments, even if they were replies
to other comments.

Also bumped version number.

Change-Id: I8d6d576fa9f3c15bef2e19310efc0b2265f8a618
---
M CodeReview.php
M api/ApiRevisionUpdate.php
M backend/CodeRevision.php
M ui/CodeRevisionCommitter.php
4 files changed, 20 insertions(+), 14 deletions(-)

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



diff --git a/CodeReview.php b/CodeReview.php
index 5df9b88..019c6fd 100644
--- a/CodeReview.php
+++ b/CodeReview.php
@@ -34,7 +34,7 @@
 $wgExtensionCredits['specialpage'][] = array(
        'path' => __FILE__,
        'name' => 'CodeReview',
-       'version' => '1.13',
+       'version' => '1.14',
        'url' => 'https://www.mediawiki.org/wiki/Extension:CodeReview',
        'author' => array( 'Brion Vibber', 'Aaron Schulz', 'Alexandre 
Emsenhuber', 'Chad Horohoe', 'Sam Reed', 'Roan Kattouw' ),
        'descriptionmsg' => 'codereview-desc',
diff --git a/api/ApiRevisionUpdate.php b/api/ApiRevisionUpdate.php
index a56ff7b..873c058 100644
--- a/api/ApiRevisionUpdate.php
+++ b/api/ApiRevisionUpdate.php
@@ -67,6 +67,7 @@
                        $params['addreferences'],
                        $params['removereferences'],
                        $params['comment'],
+                       null,
                        $params['addreferenced'],
                        $params['removereferenced']
                );
diff --git a/backend/CodeRevision.php b/backend/CodeRevision.php
index 0fa141b..a53b746 100644
--- a/backend/CodeRevision.php
+++ b/backend/CodeRevision.php
@@ -651,18 +651,17 @@
        }
 
        /**
-        * @param  $text
-        * @param  $review
-        * @param null $parent
+        * @param $text string
+        * @param $parent null
         * @return int
         */
-       public function saveComment( $text, $review, $parent = null ) {
+       public function saveComment( $text, $parent = null ) {
                $text = rtrim( $text );
                if ( !strlen( $text ) ) {
                        return 0;
                }
                $dbw = wfGetDB( DB_MASTER );
-               $data = $this->commentData( $text, $review, $parent );
+               $data = $this->commentData( $text, $parent );
 
                $dbw->begin();
                $data['cc_id'] = $dbw->nextSequenceValue( 'code_comment_cc_id' 
);
diff --git a/ui/CodeRevisionCommitter.php b/ui/CodeRevisionCommitter.php
index 2ce48f3..6eabbae 100644
--- a/ui/CodeRevisionCommitter.php
+++ b/ui/CodeRevisionCommitter.php
@@ -14,11 +14,18 @@
                        return;
                }
 
-               $commentId = $this->revisionUpdate( $this->mStatus, 
$this->mAddTags, $this->mRemoveTags,
-                       $this->mSignoffFlags, $this->mStrikeSignoffs,
-                       $this->mAddReferences, $this->mRemoveReferences,
-                       $this->text, $wgRequest->getIntOrNull( 'wpParent' ), 
$wgRequest->getInt( 'wpReview' ),
-                       $this->mAddReferenced, $this->mRemoveReferenced
+               $commentId = $this->revisionUpdate(
+                       $this->mStatus,
+                       $this->mAddTags,
+                       $this->mRemoveTags,
+                       $this->mSignoffFlags,
+                       $this->mStrikeSignoffs,
+                       $this->mAddReferences,
+                       $this->mRemoveReferences,
+                       $this->text,
+                       $wgRequest->getIntOrNull( 'wpParent' ),
+                       $this->mAddReferenced,
+                       $this->mRemoveReferenced
                );
 
                $redirTarget = null;
@@ -65,8 +72,7 @@
         */
        public function revisionUpdate( $status, $addTags, $removeTags, 
$addSignoffs, $strikeSignoffs,
                                                $addReferences, 
$removeReferences, $commentText,
-                                               $parent = null, $review = 0,
-                                               $addReferenced, 
$removeReferenced
+                                               $parent = null, $addReferenced, 
$removeReferenced
                                        ) {
                if ( !$this->mRev ) {
                        return false;
@@ -123,7 +129,7 @@
                $commentId = 0;
                if ( strlen( $commentText ) && $this->validPost( 
'codereview-post-comment' ) ) {
                        // $isPreview = $wgRequest->getCheck( 'wpPreview' );
-                       $commentId = $this->mRev->saveComment( $commentText, 
$review, $parent );
+                       $commentId = $this->mRev->saveComment( $commentText, 
$parent );
 
                        $commentAdded = ($commentId !== 0);
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8d6d576fa9f3c15bef2e19310efc0b2265f8a618
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CodeReview
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to