r76944 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76943‎ | r76944 | r76945 >
Date:11:45, 18 November 2010
Author:reedy
Status:ok
Tags:
Comment:
Followup r76905. Return comment ID rather than redirect logic layer specifics

Rename doRevisionUpdate to revisionUpdate

Will probably include comment ID into API result stuff
Modified paths:
  • /trunk/extensions/CodeReview/api/ApiRevisionUpdate.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/api/ApiRevisionUpdate.php
@@ -45,7 +45,7 @@
4646
4747 $revisionCommitter = new CodeRevisionCommitterApi( $repo, $rev );
4848
49 - $revisionCommitter->doRevisionUpdate(
 49+ $revisionCommitter->revisionUpdate(
5050 $params['status'],
5151 $params['addtags'],
5252 $params['removetags'],
Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php
@@ -14,11 +14,18 @@
1515 return;
1616 }
1717
18 - $redirTarget = $this->doRevisionUpdate( $this->mStatus, $this->mAddTags, $this->mRemoveTags,
 18+ $commentId = $this->revisionUpdate( $this->mStatus, $this->mAddTags, $this->mRemoveTags,
1919 $this->mSignoffFlags, $this->text, $wgRequest->getIntOrNull( 'wpParent' ),
2020 $wgRequest->getInt( 'wpReview' )
2121 );
2222
 23+ $redirTarget = null;
 24+
 25+ // For comments, take us back to the rev page focused on the new comment
 26+ if ( $commentId !== 0 && !$this->jumpToNext ) {
 27+ $redirTarget = $this->commentLink( $commentId );
 28+ }
 29+
2330 // Return to rev page
2431 if ( !$redirTarget ) {
2532 // Was "next & unresolved" clicked?
@@ -47,9 +54,9 @@
4855 * @param string $commentText Comment to add to the revision
4956 * @param null|int $parent What the parent comment is (if a subcomment)
5057 * @param int $review (unused)
51 - * @return null|bool|Title False if not a valid rev. Title for redirect target, else null
 58+ * @return int Comment ID if added, else 0
5259 */
53 - public function doRevisionUpdate( $status, $addTags, $removeTags, $signoffFlags, $commentText, $parent = null,
 60+ public function revisionUpdate( $status, $addTags, $removeTags, $signoffFlags, $commentText, $parent = null,
5461 $review = 0 ) {
5562
5663 if ( !$this->mRev ) {
@@ -58,8 +65,6 @@
5966
6067 global $wgUser;
6168
62 - $redirTarget = null;
63 -
6469 $dbw = wfGetDB( DB_MASTER );
6570
6671 $dbw->begin();
@@ -85,16 +90,12 @@
8691 }
8792 // Add any comments
8893 $commentAdded = false;
 94+ $commentId = 0;
8995 if ( strlen( $commentText ) && $this->validPost( 'codereview-post-comment' ) ) {
9096 // $isPreview = $wgRequest->getCheck( 'wpPreview' );
9197 $commentId = $this->mRev->saveComment( $commentText, $review, $parent );
9298
9399 $commentAdded = ($commentId !== 0);
94 -
95 - // For comments, take us back to the rev page focused on the new comment
96 - if ( !$this->jumpToNext ) {
97 - $redirTarget = $this->commentLink( $commentId );
98 - }
99100 }
100101 $dbw->commit();
101102
@@ -117,6 +118,6 @@
118119 }
119120 }
120121
121 - return $redirTarget;
 122+ return $commentId;
122123 }
123124 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76905Prequisite to bug 25940 (Add API module(s) to add comments/set revision status)...reedy21:01, 17 November 2010

Status & tagging log