https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103510
Revision: 103510
Author: bsitu
Date: 2011-11-17 20:58:13 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
follow up to r103368, add code to handle empty log for admin hide action
Modified Paths:
--------------
trunk/extensions/MoodBar/MoodBar.i18n.php
trunk/extensions/MoodBar/SpecialFeedbackDashboard.php
Modified: trunk/extensions/MoodBar/MoodBar.i18n.php
===================================================================
--- trunk/extensions/MoodBar/MoodBar.i18n.php 2011-11-17 20:45:00 UTC (rev
103509)
+++ trunk/extensions/MoodBar/MoodBar.i18n.php 2011-11-17 20:58:13 UTC (rev
103510)
@@ -95,6 +95,7 @@
'moodbar-feedback-show' => 'show hidden feedback',
'moodbar-feedback-hide' => 'hide feedback',
'moodbar-hidden-footer' => 'Hidden Feedback by $1 on $2 $3, reason: $4
$5',
+ 'moodbar-hidden-footer-without-log' => 'Hidden Feedback $1',
'moodbar-feedback-restore' => 'restore hidden feedback',
'moodbar-action-item' => 'Feedback item:',
'moodbar-action-reason' => 'Reason:',
@@ -278,6 +279,7 @@
'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.',
'moodbar-feedback-older' => 'Text of the link that the user can click
to see less recent results. Only visible if JavaScript is not enabled.',
'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}}',
+ 'moodbar-hidden-footer-without-log' => '* $1 is a link to restore the
item displaying {{msg-mw|moodbar-feedback-restore}}',
'moodbar-type-happy' => '$1 is the username that can be used for
GENDER',
'moodbar-type-sad' => '$1 is the username that can be used for GENDER',
'moodbar-type-confused' => '$1 is the username that can be used for
GENDER',
Modified: trunk/extensions/MoodBar/SpecialFeedbackDashboard.php
===================================================================
--- trunk/extensions/MoodBar/SpecialFeedbackDashboard.php 2011-11-17
20:45:00 UTC (rev 103509)
+++ trunk/extensions/MoodBar/SpecialFeedbackDashboard.php 2011-11-17
20:58:13 UTC (rev 103510)
@@ -263,12 +263,19 @@
$feedback_hidden_detail =
self::getFeedbackHiddenDetail($id);
- $footer = wfMessage('moodbar-hidden-footer')->
- rawParams( htmlspecialchars(
$feedback_hidden_detail->log_user_text ),
-
$wgLang->date($feedback_hidden_detail->log_timestamp),
-
$wgLang->time($feedback_hidden_detail->log_timestamp),
- htmlspecialchars(
$feedback_hidden_detail->log_comment ),
- $link )->escaped();
+ if($feedback_hidden_detail === false) {
+ $footer =
wfMessage('moodbar-hidden-footer-without-log')->
+ rawParams( $link )->escaped();
+ }
+ else {
+ $footer = wfMessage('moodbar-hidden-footer')->
+ rawParams( htmlspecialchars(
$feedback_hidden_detail->log_user_text ),
+
$wgLang->date($feedback_hidden_detail->log_timestamp),
+
$wgLang->time($feedback_hidden_detail->log_timestamp),
+ htmlspecialchars(
$feedback_hidden_detail->log_comment ),
+ $link )->escaped();
+ }
+
return Xml::tags( 'div', array( 'class' => 'error' ),
$footer );
} elseif ( $mode === 'hidden' ) {
$linkText =
wfMessage('moodbar-feedback-show')->escaped();
@@ -502,12 +509,12 @@
/**
* Get admin's username/timestamp/reason for hiding a feedback
* @param $mbf_id primary key for moodbar_feedback
- * @return stdObject
+ * @return ResultWrapper|bool
*/
protected static function getFeedbackHiddenDetail( $mbf_id ) {
$dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->select( array( 'logging' ),
+ return $dbr->selectRow( array( 'logging' ),
array( 'log_user_text', 'log_timestamp',
'log_comment' ),
array( 'log_namespace' => NS_SPECIAL,
'log_title' => 'FeedbackDashboard/'
. intval( $mbf_id ),
@@ -516,10 +523,6 @@
__METHOD__,
array( 'LIMIT' => 1, 'ORDER BY' =>
"log_timestamp DESC" )
);
-
- $rows = iterator_to_array( $res, /*$use_keys=*/false );
-
- return current($rows);
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs