r47182 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47181‎ | r47182 | r47183 >
Date:14:45, 12 February 2009
Author:aaron
Status:deferred
Tags:
Comment:
(bug 5776) Add extra patrol link on bottom for diffs
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -191,6 +191,7 @@
192192 );
193193 if( $change instanceof RecentChange ) {
194194 $rcid = $change->mAttribs['rc_id'];
 195+ $this->mRcidMarkPatrolled = $rcid;
195196 } else {
196197 // None found
197198 $rcid = 0;
@@ -198,11 +199,8 @@
199200 }
200201 // Build the link
201202 if( $rcid ) {
202 - $patrol = ' <span class="patrollink">[' . $sk->makeKnownLinkObj(
203 - $this->mTitle,
204 - wfMsgHtml( 'markaspatrolleddiff' ),
205 - "action=markpatrolled&rcid={$rcid}"
206 - ) . ']</span>';
 203+ $patrol = ' <span class="patrollink">[' . $sk->makeKnownLinkObj( $this->mTitle,
 204+ wfMsgHtml( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$rcid}" ) . ']</span>';
207205 } else {
208206 $patrol = '';
209207 }
@@ -297,7 +295,7 @@
298296 * Show the new revision of the page.
299297 */
300298 function renderNewRevision() {
301 - global $wgOut;
 299+ global $wgOut, $wgUser;
302300 wfProfileIn( __METHOD__ );
303301
304302 $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
@@ -332,9 +330,18 @@
333331 $wgOut->addWikiTextTidy( $this->mNewtext );
334332 }
335333
336 - if( !$this->mNewRev->isCurrent() ) {
 334+ if( is_object( $this->mNewRev ) && !$this->mNewRev->isCurrent() ) {
337335 $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting );
338336 }
 337+ # Add redundant patrol link on bottom...
 338+ if( $this->mRcidMarkPatrolled && $this->mTitle->quickUserCan('patrol') ) {
 339+ $sk = $wgUser->getSkin();
 340+ $wgOut->addHTML(
 341+ "<div class='patrollink'>[" . $sk->makeKnownLinkObj( $this->mTitle,
 342+ wfMsgHtml( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) .
 343+ ']</div>'
 344+ );
 345+ }
339346
340347 wfProfileOut( __METHOD__ );
341348 }

Status & tagging log