r103510 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103509‎ | r103510 | r103511 >
Date:20:58, 17 November 2011
Author:bsitu
Status:ok
Tags:
Comment:
follow up to r103368, add code to handle empty log for admin hide action
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/SpecialFeedbackDashboard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/SpecialFeedbackDashboard.php
@@ -263,12 +263,19 @@
264264
265265 $feedback_hidden_detail = self::getFeedbackHiddenDetail($id);
266266
267 - $footer = wfMessage('moodbar-hidden-footer')->
268 - rawParams( htmlspecialchars( $feedback_hidden_detail->log_user_text ),
269 - $wgLang->date($feedback_hidden_detail->log_timestamp),
270 - $wgLang->time($feedback_hidden_detail->log_timestamp),
271 - htmlspecialchars( $feedback_hidden_detail->log_comment ),
272 - $link )->escaped();
 267+ if($feedback_hidden_detail === false) {
 268+ $footer = wfMessage('moodbar-hidden-footer-without-log')->
 269+ rawParams( $link )->escaped();
 270+ }
 271+ else {
 272+ $footer = wfMessage('moodbar-hidden-footer')->
 273+ rawParams( htmlspecialchars( $feedback_hidden_detail->log_user_text ),
 274+ $wgLang->date($feedback_hidden_detail->log_timestamp),
 275+ $wgLang->time($feedback_hidden_detail->log_timestamp),
 276+ htmlspecialchars( $feedback_hidden_detail->log_comment ),
 277+ $link )->escaped();
 278+ }
 279+
273280 return Xml::tags( 'div', array( 'class' => 'error' ), $footer );
274281 } elseif ( $mode === 'hidden' ) {
275282 $linkText = wfMessage('moodbar-feedback-show')->escaped();
@@ -502,12 +509,12 @@
503510 /**
504511 * Get admin's username/timestamp/reason for hiding a feedback
505512 * @param $mbf_id primary key for moodbar_feedback
506 - * @return stdObject
 513+ * @return ResultWrapper|bool
507514 */
508515 protected static function getFeedbackHiddenDetail( $mbf_id ) {
509516 $dbr = wfGetDB( DB_SLAVE );
510517
511 - $res = $dbr->select( array( 'logging' ),
 518+ return $dbr->selectRow( array( 'logging' ),
512519 array( 'log_user_text', 'log_timestamp', 'log_comment' ),
513520 array( 'log_namespace' => NS_SPECIAL,
514521 'log_title' => 'FeedbackDashboard/' . intval( $mbf_id ),
@@ -516,10 +523,6 @@
517524 __METHOD__,
518525 array( 'LIMIT' => 1, 'ORDER BY' => "log_timestamp DESC" )
519526 );
520 -
521 - $rows = iterator_to_array( $res, /*$use_keys=*/false );
522 -
523 - return current($rows);
524527 }
525528
526529 }
Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -95,6 +95,7 @@
9696 'moodbar-feedback-show' => 'show hidden feedback',
9797 'moodbar-feedback-hide' => 'hide feedback',
9898 'moodbar-hidden-footer' => 'Hidden Feedback by $1 on $2 $3, reason: $4 $5',
 99+ 'moodbar-hidden-footer-without-log' => 'Hidden Feedback $1',
99100 'moodbar-feedback-restore' => 'restore hidden feedback',
100101 'moodbar-action-item' => 'Feedback item:',
101102 'moodbar-action-reason' => 'Reason:',
@@ -278,6 +279,7 @@
279280 'moodbar-feedback-newer' => 'Text of the link that the user can click to go back to more recent results. Only visible if JavaScript is not enabled.',
280281 'moodbar-feedback-older' => 'Text of the link that the user can click to see less recent results. Only visible if JavaScript is not enabled.',
281282 'moodbar-hidden-footer' => '* $1 is the username, $2 is the date, $3 is the time, $4 is the reason for hiding the feedback,$5 is a link to restore the item displaying {{msg-mw|moodbar-feedback-restore}}',
 283+ 'moodbar-hidden-footer-without-log' => '* $1 is a link to restore the item displaying {{msg-mw|moodbar-feedback-restore}}',
282284 'moodbar-type-happy' => '$1 is the username that can be used for GENDER',
283285 'moodbar-type-sad' => '$1 is the username that can be used for GENDER',
284286 'moodbar-type-confused' => '$1 is the username that can be used for GENDER',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103368follow up to r103251, remove array when calling Message::rawParams() and use ...bsitu19:58, 16 November 2011

Status & tagging log