Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php |
— | — | @@ -138,12 +138,23 @@ |
139 | 139 | "<div class='mw-codereview-diff' id='mw-codereview-diff'>" . $diffHtml . "</div>\n"; |
140 | 140 | $html .= $this->formatImgDiff(); |
141 | 141 | } |
| 142 | + |
142 | 143 | # 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 | + |
145 | 151 | # 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 | + |
148 | 159 | # Add revision comments |
149 | 160 | if ( $comments ) { |
150 | 161 | $html .= "<h2 id='code-comments'>" . wfMsgHtml( 'code-comments' ) . |
— | — | @@ -449,10 +460,10 @@ |
450 | 461 | * @param $showButtons bool Whether the buttons to strike and submit sign-offs should be shown |
451 | 462 | * @return string HTML |
452 | 463 | */ |
453 | | - protected function formatSignoffs( $showButtons ) { |
| 464 | + protected function formatSignoffs( $signOffs, $showButtons ) { |
454 | 465 | $this->showButtonsFormatSignoffs = $showButtons; |
455 | 466 | $signoffs = implode( "\n", |
456 | | - array_map( array( $this, 'formatSignoffInline' ), $this->mRev->getSignoffs() ) |
| 467 | + array_map( array( $this, 'formatSignoffInline' ), $signOffs ) |
457 | 468 | ); |
458 | 469 | |
459 | 470 | $header = ''; |
— | — | @@ -489,10 +500,10 @@ |
490 | 501 | return "<ul class='mw-codereview-changes'>$changes</ul>"; |
491 | 502 | } |
492 | 503 | |
493 | | - protected function formatReferences( $showButtons ) { |
| 504 | + protected function formatReferences( $references, $showButtons ) { |
494 | 505 | $this->showButtonsFormatReference = $showButtons; |
495 | 506 | $refs = implode( "\n", |
496 | | - array_map( array( $this, 'formatReferenceInline' ), $this->mRev->getReferences() ) |
| 507 | + array_map( array( $this, 'formatReferenceInline' ), $references ) |
497 | 508 | ); |
498 | 509 | |
499 | 510 | $header = ''; |