Index: trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php |
— | — | @@ -55,11 +55,6 @@ |
56 | 56 | // User-specific data |
57 | 57 | $ratings[$params['pageid']]['status'] = 'current'; |
58 | 58 | if ( $params['userrating'] ) { |
59 | | - // Expertise |
60 | | - $expertise = $this->getExpertise( $params ); |
61 | | - if ( $expertise !== false ) { |
62 | | - $ratings[$params['pageid']]['expertise'] = $expertise; |
63 | | - } |
64 | 59 | // User ratings |
65 | 60 | $userRatings = $this->getUserRatings( $params ); |
66 | 61 | if ( isset( $ratings[$params['pageid']]['ratings'] ) ) { |
— | — | @@ -101,6 +96,13 @@ |
102 | 97 | ); |
103 | 98 | } |
104 | 99 | } |
| 100 | + // Expertise |
| 101 | + if ( isset( $ratings[$params['pageid']]['revid'] ) ) { |
| 102 | + $expertise = $this->getExpertise( $params, $ratings[$params['pageid']]['revid'] ); |
| 103 | + if ( $expertise !== false ) { |
| 104 | + $ratings[$params['pageid']]['expertise'] = $expertise; |
| 105 | + } |
| 106 | + } |
105 | 107 | } |
106 | 108 | |
107 | 109 | foreach ( $ratings as $rat ) { |
— | — | @@ -149,7 +151,7 @@ |
150 | 152 | return $token; |
151 | 153 | } |
152 | 154 | |
153 | | - protected function getExpertise( $params ) { |
| 155 | + protected function getExpertise( $params, $revid ) { |
154 | 156 | global $wgUser; |
155 | 157 | |
156 | 158 | return $this->getDB()->selectField( |
— | — | @@ -159,9 +161,9 @@ |
160 | 162 | 'afp_key' => 'expertise', |
161 | 163 | 'afp_user_text' => $wgUser->getName(), |
162 | 164 | 'afp_user_anon_token' => $this->getAnonToken( $params ), |
| 165 | + 'afp_revision' => $revid, |
163 | 166 | ), |
164 | | - __METHOD__, |
165 | | - array( 'ORDER BY', 'afp_revision DESC' ) |
| 167 | + __METHOD__ |
166 | 168 | ); |
167 | 169 | } |
168 | 170 | |