r54257 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54256‎ | r54257 | r54258 >
Date:08:57, 3 August 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
Some ugly revision hiding support
Modified paths:
  • /trunk/extensions/CleanChanges/CleanChanges_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CleanChanges/CleanChanges_body.php
@@ -114,10 +114,15 @@
115115 }
116116
117117 protected function getLogAction( $rc ) {
118 - if ( $this->isDeleted($rc, LogPage::DELETED_ACTION) ) {
 118+ global $wgUser;
 119+
 120+ $priviledged = $wgUser->isAllowed('deleterevision');
 121+ $deleted = $this->isDeleted($rc, LogPage::DELETED_ACTION);
 122+
 123+ if ( $deleted && !$priviledged ) {
119124 return $this->XMLwrapper( 'history-deleted', wfMsg('rev-deleted-event') );
120125 } else {
121 - return LogPage::actionText(
 126+ $action = LogPage::actionText(
122127 $rc->getAttribute('rc_log_type'),
123128 $rc->getAttribute('rc_log_action'),
124129 $rc->getTitle(),
@@ -126,6 +131,11 @@
127132 true,
128133 true
129134 );
 135+ if ( $deleted ) {
 136+ $class = array( 'class' => 'history-deleted' );
 137+ $action = Xml::tags( 'span', $class, $action );
 138+ }
 139+ return $action;
130140 }
131141 }
132142
@@ -176,13 +186,8 @@
177187 $rc->getAttribute( 'rc_user_text' ) );
178188 $rc->_userInfo = $stuff[0];
179189
180 - $rc->_comment = $this->skin->commentBlock(
181 - $rc->getAttribute( 'rc_comment' ), $titleObj );
 190+ $rc->_comment = $this->getComment( $rc );
182191
183 - if ( $logEntry ) {
184 - $rc->_comment = $this->getLogAction( $rc ) . ' ' . $rc->_comment;
185 - }
186 -
187192 $rc->_watching = $this->numberofWatchingusers( $baseRC->numberofWatchingusers );
188193
189194
@@ -408,6 +413,26 @@
409414
410415 }
411416
 417+ public function getComment( $rc ) {
 418+ global $wgUser;
 419+ $comment = $rc->getAttribute( 'rc_comment' );
 420+ $action = '';
 421+ if ( $this->isLog($rc) ) $action = $this->getLogAction( $rc );
 422+
 423+ if ( $comment === '' ) {
 424+ return $action;
 425+ } elseif ( $this->isDeleted( $rc, LogPage::DELETED_COMMENT ) ) {
 426+ $priviledged = $wgUser->isAllowed('deleterevision');
 427+ if ( $priviledged ) {
 428+ return $action . ' <span class="history-deleted">' . $comment . '</span>';
 429+ } else {
 430+ return $action . ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
 431+ }
 432+ } else {
 433+ return $action . $this->skin->commentBlock( $comment, $rc->getTitle() );
 434+ }
 435+ }
 436+
412437 /**
413438 * Enhanced user tool links, with javascript functionality.
414439 */

Status & tagging log