r108922 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108921‎ | r108922 | r108923 >
Date:17:13, 14 January 2012
Author:reedy
Status:resolved
Tags:miscextensions 
Comment:
And that should be the rest of bug 33713
Modified paths:
  • /trunk/extensions/CodeReview/api/ApiRevisionUpdate.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -1027,6 +1027,21 @@
10281028 }
10291029
10301030 /**
 1031+ * Remove references to the specified revisions from this revision.
 1032+ *
 1033+ * @param $revs array of revision IDs
 1034+ */
 1035+ public function removeReferencesTo( $revs ) {
 1036+ $dbw = wfGetDB( DB_MASTER );
 1037+ $dbw->delete( 'code_relations', array(
 1038+ 'cf_repo_id' => $this->getRepoId(),
 1039+ 'cf_from' => $this->getId(),
 1040+ 'cf_to' => $revs
 1041+ ), __METHOD__
 1042+ );
 1043+ }
 1044+
 1045+ /**
10311046 * Get all sign-offs for this revision
10321047 * @param $from int DB_SLAVE or DB_MASTER
10331048 * @return array of CodeSignoff objects
Index: trunk/extensions/CodeReview/api/ApiRevisionUpdate.php
@@ -66,7 +66,9 @@
6767 $params['removeflags'],
6868 $params['addreferences'],
6969 $params['removereferences'],
70 - $params['comment']
 70+ $params['comment'],
 71+ $params['addreferenced'],
 72+ $params['removereferenced']
7173 );
7274
7375 // Forge a response object
@@ -134,6 +136,14 @@
135137 ApiBase::PARAM_TYPE => 'integer',
136138 ApiBase::PARAM_ISMULTI => true,
137139 ),
 140+ 'addreferenced' => array(
 141+ ApiBase::PARAM_TYPE => 'integer',
 142+ ApiBase::PARAM_ISMULTI => true,
 143+ ),
 144+ 'removereferenced' => array(
 145+ ApiBase::PARAM_TYPE => 'integer',
 146+ ApiBase::PARAM_ISMULTI => true,
 147+ ),
138148 );
139149 }
140150
@@ -149,6 +159,8 @@
150160 'removeflags' => 'Code Signoff flags to strike from the revision by the current user',
151161 'addreferences' => 'Add references to this revision',
152162 'removereferences' => 'Remove references from this revision',
 163+ 'addreferenced' => 'Add referenced revisions from this revision',
 164+ 'removereferenced' => 'Remove referenced revisions from this revision',
153165 );
154166 }
155167
Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php
@@ -15,9 +15,10 @@
1616 }
1717
1818 $commentId = $this->revisionUpdate( $this->mStatus, $this->mAddTags, $this->mRemoveTags,
19 - $this->mSignoffFlags, $this->mStrikeSignoffs, $this->mAddReferences, $this->mRemoveReferences,
20 - $this->text, $wgRequest->getIntOrNull( 'wpParent' ),
21 - $wgRequest->getInt( 'wpReview' )
 19+ $this->mSignoffFlags, $this->mStrikeSignoffs,
 20+ $this->mAddReferences, $this->mRemoveReferences,
 21+ $this->text, $wgRequest->getIntOrNull( 'wpParent' ), $wgRequest->getInt( 'wpReview' ),
 22+ $this->mAddReferenced, $this->mRemoveReferenced
2223 );
2324
2425 $redirTarget = null;
@@ -62,7 +63,9 @@
6364 */
6465 public function revisionUpdate( $status, $addTags, $removeTags, $addSignoffs, $strikeSignoffs,
6566 $addReferences, $removeReferences, $commentText,
66 - $parent = null, $review = 0 ) {
 67+ $parent = null, $review = 0,
 68+ $addReferenced, $removeReferenced
 69+ ) {
6770 if ( !$this->mRev ) {
6871 return false;
6972 }
@@ -104,6 +107,14 @@
105108 if ( count( $removeReferences ) && $this->validPost( 'codereview-associate' ) ) {
106109 $this->mRev->removeReferencesFrom( $removeReferences );
107110 }
 111+ // Add reference if requested
 112+ if ( count( $addReferenced ) && $this->validPost( 'codereview-associate' ) ) {
 113+ $this->mRev->addReferencesTo( $addReferenced );
 114+ }
 115+ // Remove references if requested
 116+ if ( count( $removeReferenced ) && $this->validPost( 'codereview-associate' ) ) {
 117+ $this->mRev->removeReferencesFrom( $removeReferenced );
 118+ }
108119
109120 // Add any comments
110121 $commentAdded = false;
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -54,7 +54,14 @@
5555 : array();
5656
5757 $this->mRemoveReferences = $wgRequest->getCheck( 'wpRemoveReferences' ) ?
58 - $wgRequest->getIntArray( 'wpReferences', array() ) : array();
 58+ $wgRequest->getIntArray( 'wpReferenced', array() ) : array();
 59+
 60+ $this->mAddReferenced = $wgRequest->getCheck( 'wpAddReferencedSubmit' )
 61+ ? $this->stringToRevList( $wgRequest->getText( 'wpAddReferenced' ) )
 62+ : array();
 63+
 64+ $this->mRemoveReferenced = $wgRequest->getCheck( 'wpRemoveReferenced' ) ?
 65+ $wgRequest->getIntArray( 'wpReferenced', array() ) : array();
5966 }
6067
6168 /**
@@ -189,7 +196,7 @@
190197 $referenced = $this->mRev->getFollowedUpRevisions();
191198 if ( count( $referenced ) || $userCanAssociate ) {
192199 $html .= "<h2 id='code-referenced'>" . wfMsgHtml( 'code-referenced' ) .
193 - "</h2>\n" . $this->formatReferences( $referenced, /*$userCanAssociate*/false, 'Referenced' );
 200+ "</h2>\n" . $this->formatReferences( $referenced, $userCanAssociate, 'Referenced' );
194201 }
195202
196203 # Add revision comments

Follow-up revisions

RevisionCommit summaryAuthorDate
r108923Ping r108922...reedy17:21, 14 January 2012
r108924And fix wrong method call from r108922reedy17:28, 14 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108907Bit of prep work for bug 33713...reedy15:25, 14 January 2012
r108911Bug 33713 - Show "previous" revisions in addition to follow-ups...reedy15:54, 14 January 2012
r108912Bug 33713 - Show "previous" revisions in addition to follow-ups...reedy15:59, 14 January 2012
r108920Few more bits of refactoring for bug 33713reedy17:02, 14 January 2012

Status & tagging log