r82146 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82145‎ | r82146 | r82147 >
Date:21:17, 14 February 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 27407) Hide "Sign offs" section when empty for users without the codereview-signoff right

Same for followup/associations
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -138,12 +138,23 @@
139139 "<div class='mw-codereview-diff' id='mw-codereview-diff'>" . $diffHtml . "</div>\n";
140140 $html .= $this->formatImgDiff();
141141 }
 142+
142143 # Show sign-offs
143 - $html .= "<h2 id='code-signoffs'>" . wfMsgHtml( 'code-signoffs' ) .
144 - "</h2>\n" . $this->formatSignoffs( $this->canSignoff() );
 144+ $userCanSignoff = $this->canSignoff();
 145+ $signOffs = $this->mRev->getSignoffs();
 146+ if ( count( $signOffs ) || $userCanSignoff ) {
 147+ $html .= "<h2 id='code-signoffs'>" . wfMsgHtml( 'code-signoffs' ) .
 148+ "</h2>\n" . $this->formatSignoffs( $signOffs, $userCanSignoff );
 149+ }
 150+
145151 # Show code relations
146 - $html .= "<h2 id='code-references'>" . wfMsgHtml( 'code-references' ) .
147 - "</h2>\n" . $this->formatReferences( $this->canAssociate() );
 152+ $userCanAssociate = $this->canAssociate();
 153+ $references = $this->mRev->getReferences();
 154+ if ( count( $references ) || $userCanAssociate ) {
 155+ $html .= "<h2 id='code-references'>" . wfMsgHtml( 'code-references' ) .
 156+ "</h2>\n" . $this->formatReferences( $references, $userCanAssociate );
 157+ }
 158+
148159 # Add revision comments
149160 if ( $comments ) {
150161 $html .= "<h2 id='code-comments'>" . wfMsgHtml( 'code-comments' ) .
@@ -449,10 +460,10 @@
450461 * @param $showButtons bool Whether the buttons to strike and submit sign-offs should be shown
451462 * @return string HTML
452463 */
453 - protected function formatSignoffs( $showButtons ) {
 464+ protected function formatSignoffs( $signOffs, $showButtons ) {
454465 $this->showButtonsFormatSignoffs = $showButtons;
455466 $signoffs = implode( "\n",
456 - array_map( array( $this, 'formatSignoffInline' ), $this->mRev->getSignoffs() )
 467+ array_map( array( $this, 'formatSignoffInline' ), $signOffs )
457468 );
458469
459470 $header = '';
@@ -489,10 +500,10 @@
490501 return "<ul class='mw-codereview-changes'>$changes</ul>";
491502 }
492503
493 - protected function formatReferences( $showButtons ) {
 504+ protected function formatReferences( $references, $showButtons ) {
494505 $this->showButtonsFormatReference = $showButtons;
495506 $refs = implode( "\n",
496 - array_map( array( $this, 'formatReferenceInline' ), $this->mRev->getReferences() )
 507+ array_map( array( $this, 'formatReferenceInline' ), $references )
497508 );
498509
499510 $header = '';

Follow-up revisions

RevisionCommit summaryAuthorDate
r821511.17wmf1: MFT r78964, r79086, r79087, r79091, r82004, r82025, r82048, r82070,...catrope22:55, 14 February 2011
r82299Followup r82146...reedy21:45, 16 February 2011

Status & tagging log