r79625 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79624‎ | r79625 | r79626 >
Date:22:35, 4 January 2011
Author:reedy
Status:resolved
Tags:
Comment:
Structural changes to allow filtering by comments

Special:Code/MediaWiki/comments/author/Reedy (needs to be wikiname)

And Special:Code/MediaWiki/comments?author=Reedy
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeCommentsAuthorListView.php (added) (history)
  • /trunk/extensions/CodeReview/ui/CodeCommentsListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -70,6 +70,7 @@
7171 $wgAutoloadClasses['CodeStatusListView'] = $dir . 'ui/CodeStatusListView.php';
7272 $wgAutoloadClasses['CodeTagListView'] = $dir . 'ui/CodeTagListView.php';
7373 $wgAutoloadClasses['CodeCommentsListView'] = $dir . 'ui/CodeCommentsListView.php';
 74+$wgAutoloadClasses['CodeCommentAuthorListView'] = $dir . 'ui/CodeCommentAuthorListView.php';
7475 $wgAutoloadClasses['CodeReleaseNotes'] = $dir . 'ui/CodeReleaseNotes.php';
7576 $wgAutoloadClasses['CodeStatusChangeListView'] = $dir . 'ui/CodeStatusChangeListView.php';
7677 $wgAutoloadClasses['SpecialCode'] = $dir . 'ui/SpecialCode.php';
Index: trunk/extensions/CodeReview/ui/CodeCommentsAuthorListView.php
@@ -0,0 +1,8 @@
 2+<?php
 3+
 4+class CodeCommentAuthorListView extends CodeCommentsListView {
 5+ function __construct( $repo, $author ) {
 6+ parent::__construct( $repo );
 7+ $this->mAuthor = $author;
 8+ }
 9+}
Property changes on: trunk/extensions/CodeReview/ui/CodeCommentsAuthorListView.php
___________________________________________________________________
Added: svn:eol-style
110 + native
Index: trunk/extensions/CodeReview/ui/CodeCommentsListView.php
@@ -4,9 +4,15 @@
55 class CodeCommentsListView extends CodeView {
66 public $mRepo;
77
8 - function __construct( $repoName ) {
 8+ function __construct( $repo ) {
99 parent::__construct();
10 - $this->mRepo = CodeRepository::newFromName( $repoName );
 10+
 11+ $this->mRepo = ( $repo instanceof CodeRepository )
 12+ ? $repo
 13+ : CodeRepository::newFromName( $repo );
 14+
 15+ global $wgRequest;
 16+ $this->mAuthor = $wgRequest->getText( 'author' );
1117 }
1218
1319 function execute() {
@@ -54,7 +60,7 @@
5561 }
5662
5763 function getFieldNames() {
58 - return array(
 64+ $query = array(
5965 'cc_timestamp' => wfMsg( 'code-field-timestamp' ),
6066 'cc_user_text' => wfMsg( 'code-field-user' ),
6167 'cc_rev_id' => wfMsg( 'code-field-id' ),
@@ -62,6 +68,12 @@
6369 'cr_message' => wfMsg( 'code-field-message' ),
6470 'cc_text' => wfMsg( 'code-field-text' ),
6571 );
 72+
 73+ if( $this->mView->mAuthor ) {
 74+ $query['conds']['cc_user_text'] = $this->mView->mAuthor;
 75+ }
 76+
 77+ return $query;
6678 }
6779
6880 function formatValue( $name, $value ) {
Index: trunk/extensions/CodeReview/ui/SpecialCode.php
@@ -99,7 +99,7 @@
100100 $view = new CodeRevisionStatusView( $params[0], $params[2] );
101101 break;
102102 } elseif ( $params[1] === 'comments' ) {
103 - $view = new CodeCommentsListView( $params[0] );
 103+ $view = new CodeCommentAuthorListView( $params[0], $params[2] );
104104 break;
105105 } else {
106106 # Nonsense parameters, back out

Follow-up revisions

RevisionCommit summaryAuthorDate
r79626Fixup parameters from r79625reedy22:37, 4 January 2011
r79630More for r79625, add index to improve query efficiency code_comment (cc_repo_...reedy22:49, 4 January 2011

Status & tagging log