r92514 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92513‎ | r92514 | r92515 >
Date:00:53, 19 July 2011
Author:werdna
Status:ok
Tags:
Comment:
Fix MoodBar backend: a bug and a failure accepting tokens.
Modified paths:
  • /trunk/extensions/MoodBar/ApiMoodBar.php (modified) (history)
  • /trunk/extensions/MoodBar/FeedbackItem.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/ApiMoodBar.php
@@ -8,8 +8,17 @@
99
1010 // Params are deliberately named the same as the properties,
1111 // just slurp them through.
12 - $item = MBFeedbackItem::create( $params );
 12+ $item = MBFeedbackItem::create( array() );
1313
 14+ $setParams = array();
 15+ foreach( $params as $key => $value ) {
 16+ if ( $item->isValidKey( $key ) ) {
 17+ $setParams[$key] = $value;
 18+ }
 19+ }
 20+
 21+ $item->setProperties( $setParams );
 22+
1423 $item->save();
1524
1625 $result = array( 'result' => 'success' );
@@ -46,6 +55,7 @@
4756 'system' => null,
4857 'locale' => null,
4958 'bucket' => null,
 59+ 'token' => null,
5060 );
5161 }
5262
Index: trunk/extensions/MoodBar/FeedbackItem.php
@@ -130,10 +130,10 @@
131131 }
132132
133133 if ( $key == 'user' ) {
134 - if ( $user->isAnon() ) {
 134+ if ( $value->isAnon() ) {
135135 $this->setProperty( 'user-editcount', 0 );
136136 } else {
137 - $this->setProperty( 'user-editcount', $user->edits() );
 137+ $this->setProperty( 'user-editcount', $value->getEditCount() );
138138 }
139139 }
140140

Status & tagging log