Index: trunk/extensions/MoodBar/ApiMoodBar.php |
— | — | @@ -8,8 +8,17 @@ |
9 | 9 | |
10 | 10 | // Params are deliberately named the same as the properties, |
11 | 11 | // just slurp them through. |
12 | | - $item = MBFeedbackItem::create( $params ); |
| 12 | + $item = MBFeedbackItem::create( array() ); |
13 | 13 | |
| 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 | + |
14 | 23 | $item->save(); |
15 | 24 | |
16 | 25 | $result = array( 'result' => 'success' ); |
— | — | @@ -46,6 +55,7 @@ |
47 | 56 | 'system' => null, |
48 | 57 | 'locale' => null, |
49 | 58 | 'bucket' => null, |
| 59 | + 'token' => null, |
50 | 60 | ); |
51 | 61 | } |
52 | 62 | |
Index: trunk/extensions/MoodBar/FeedbackItem.php |
— | — | @@ -130,10 +130,10 @@ |
131 | 131 | } |
132 | 132 | |
133 | 133 | if ( $key == 'user' ) { |
134 | | - if ( $user->isAnon() ) { |
| 134 | + if ( $value->isAnon() ) { |
135 | 135 | $this->setProperty( 'user-editcount', 0 ); |
136 | 136 | } else { |
137 | | - $this->setProperty( 'user-editcount', $user->edits() ); |
| 137 | + $this->setProperty( 'user-editcount', $value->getEditCount() ); |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |