r77087 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77086‎ | r77087 | r77088 >
Date:21:41, 21 November 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
*(bug 26015) Wikilink to signoff users to userpage if user is linked

Currently untested!
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/archives/code_signoffs.sql (modified) (history)
  • /trunk/extensions/CodeReview/archives/code_signoffs_userid.sql (added) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeSignoff.php (modified) (history)
  • /trunk/extensions/CodeReview/codereview.sql (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -175,16 +175,24 @@
176176 $base = dirname( __FILE__ );
177177 switch ( $updater->getDB()->getType() ) {
178178 case 'mysql':
179 - $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) ); // Initial install tables
180 - $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_diff', "$base/archives/codereview-cr_diff.sql", true ) );
181 - $updater->addExtensionUpdate( array( 'addIndex', 'code_relations', 'repo_to_from', "$base/archives/code_relations_index.sql", true ) );
 179+ $updater->addExtensionUpdate( array( 'addTable', 'code_rev',
 180+ "$base/codereview.sql", true ) ); // Initial install tables
 181+ $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_diff',
 182+ "$base/archives/codereview-cr_diff.sql", true ) );
 183+ $updater->addExtensionUpdate( array( 'addIndex', 'code_relations', 'repo_to_from',
 184+ "$base/archives/code_relations_index.sql", true ) );
182185
183186 if ( !$updater->updateRowExists( 'make cr_status varchar' ) ) {
184 - $updater->addExtensionUpdate( array( 'modifyField', 'code_rev', 'cr_status', "$base/archives/codereview-cr_status_varchar.sql", true ) );
 187+ $updater->addExtensionUpdate( array( 'modifyField', 'code_rev', 'cr_status',
 188+ "$base/archives/codereview-cr_status_varchar.sql", true ) );
185189 }
186190
187191 $updater->addExtensionUpdate( array( 'addTable', 'code_bugs', "$base/archives/code_bugs.sql", true ) );
 192+
188193 $updater->addExtensionUpdate( array( 'addTable', 'code_signoffs', "$base/archives/code_signoffs.sql", true ) );
 194+
 195+ $updater->addExtensionUpdate( array( 'addField', 'code_signoffs', 'cs_user',
 196+ "$base/archives/code_signoffs_userid.sql", true ) );
189197 break;
190198 case 'sqlite':
191199 $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) );
Index: trunk/extensions/CodeReview/archives/code_signoffs_userid.sql
@@ -0,0 +1,2 @@
 2+ALTER TABLE /*_*/code_signoffs
 3+ ADD COLUMN cs_user int not null AFTER cs_rev_id;
\ No newline at end of file
Property changes on: trunk/extensions/CodeReview/archives/code_signoffs_userid.sql
___________________________________________________________________
Added: svn:eol-style
14 + native
Index: trunk/extensions/CodeReview/archives/code_signoffs.sql
@@ -4,6 +4,7 @@
55 cs_rev_id int not null,
66
77 -- User that signed off
 8+ cs_user int not null,
89 cs_user_text varchar(255) not null,
910
1011 -- Type of signoff. Current values: 'inspected', 'tested'
Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -648,7 +648,7 @@
649649 public function getSignoffs( $from = DB_SLAVE ) {
650650 $db = wfGetDB( $from );
651651 $result = $db->select( 'code_signoffs',
652 - array( 'cs_user_text', 'cs_flag', 'cs_timestamp' ),
 652+ array( 'cs_user', 'cs_user_text', 'cs_flag', 'cs_timestamp' ),
653653 array(
654654 'cs_repo_id' => $this->mRepoId,
655655 'cs_rev_id' => $this->mId,
@@ -664,6 +664,11 @@
665665 return $signoffs;
666666 }
667667
 668+ /**
 669+ * @param $user User
 670+ * @param $flags
 671+ * @return void
 672+ */
668673 public function addSignoff( $user, $flags ) {
669674 $dbw = wfGetDB( DB_MASTER );
670675 $rows = array();
@@ -671,6 +676,7 @@
672677 $rows[] = array(
673678 'cs_repo_id' => $this->mRepoId,
674679 'cs_rev_id' => $this->mId,
 680+ 'cs_user' => $user->getID(),
675681 'cs_user_text' => $user->getName(),
676682 'cs_flag' => $flag,
677683 'cs_timestamp' => $dbw->timestamp(),
Index: trunk/extensions/CodeReview/backend/CodeSignoff.php
@@ -1,10 +1,11 @@
22 <?php
33 class CodeSignoff {
4 - public $rev, $user, $flag, $timestamp;
 4+ public $rev, $user, $flag, $timestamp, $userText;
55
6 - public function __construct( $rev, $user, $flag, $timestamp ) {
 6+ public function __construct( $rev, $user, $userText, $flag, $timestamp ) {
77 $this->rev = $rev;
88 $this->user = $user;
 9+ $this->userText = $userText;
910 $this->flag = $flag;
1011 $this->timestamp = $timestamp;
1112 }
@@ -14,7 +15,7 @@
1516 }
1617
1718 public static function newFromData( $rev, $data ) {
18 - return new self( $rev, $data['cs_user_text'], $data['cs_flag'],
 19+ return new self( $rev, $data['cs_user'], $data['cs_user_text'], $data['cs_flag'],
1920 wfTimestamp( TS_MW, $data['cs_timestamp'] )
2021 );
2122 }
Index: trunk/extensions/CodeReview/codereview.sql
@@ -228,6 +228,7 @@
229229 cs_rev_id int not null,
230230
231231 -- User that signed off
 232+ cs_user int not null,
232233 cs_user_text varchar(255) not null,
233234
234235 -- Type of signoff. Current values: 'inspected', 'tested'
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -481,9 +481,14 @@
482482 return "<table border='1' class='TablePager'><tr>{$header}</tr>{$refs}</table>";
483483 }
484484
 485+ /**
 486+ * @param $signoff CodeSignoff
 487+ * @return string
 488+ */
485489 protected function formatSignoffInline( $signoff ) {
486490 global $wgLang;
487 - $user = htmlspecialchars( $signoff->user );
 491+ $user = $this->skin->userLink( $signoff->user, $signoff->userText );
 492+
488493 $flag = htmlspecialchars( $signoff->flag );
489494 $date = $wgLang->timeanddate( $signoff->timestamp, true );
490495 $class = "mw-codereview-signoff-$flag";

Follow-up revisions

RevisionCommit summaryAuthorDate
r77183Fix code_signoffs.cs_user creation on sqlite DB...hashar21:06, 23 November 2010

Comments

#Comment by Reedy (talk | contribs)   21:46, 21 November 2010

1 minor caveat. Anyone with any preexisting "signoffs" locally, are gonna end up with Special:Contributions/Reedy links

But it's a minor issue

Status & tagging log