r78413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78412‎ | r78413 | r78414 >
Date:23:48, 14 December 2010
Author:reedy
Status:deferred
Tags:
Comment:
Allow bucket id to be passed to the Api ArticleFeedback
Modified paths:
  • /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php
@@ -66,7 +66,7 @@
6767 $thisRating, $lastRating
6868 );
6969
70 - $this->insertUserRatings( $pageId, $revisionId, $wgUser, $token, $rating, $thisRating );
 70+ $this->insertUserRatings( $pageId, $revisionId, $wgUser, $token, $rating, $thisRating, $params['bucket'] );
7171 }
7272
7373 $r = array( 'result' => 'Success' );
@@ -130,8 +130,9 @@
131131 * @param $token Array: Token if necessary
132132 * @param $ratingId Integer: Rating Id
133133 * @param $ratingValue Integer: Value of the Rating
 134+ * @param $bucket Integer: Which rating widget was the user shown
134135 */
135 - private function insertUserRatings( $pageId, $revisionId, $user, $token, $ratingId, $ratingValue ) {
 136+ private function insertUserRatings( $pageId, $revisionId, $user, $token, $ratingId, $ratingValue, $bucket ) {
136137 $dbw = wfGetDB( DB_MASTER );
137138
138139 $timestamp = $dbw->timestamp();
@@ -147,6 +148,7 @@
148149 'aa_timestamp' => $timestamp,
149150 'aa_rating_id' => $ratingId,
150151 'aa_rating_value' => $ratingValue,
 152+ 'aa_design_bucket' => $bucket
151153 ),
152154 $token
153155 ),
@@ -189,6 +191,12 @@
190192 ApiBase::PARAM_ISMULTI => false,
191193 ),
192194 'anontoken' => null,
 195+ 'bucket' => array(
 196+ ApiBase::PARAM_TYPE => 'integer',
 197+ ApiBase::PARAM_REQUIRED => true,
 198+ ApiBase::PARAM_ISMULTI => false,
 199+ ApiBase::PARAM_MIN => 1
 200+ )
193201 );
194202
195203 foreach( $wgArticleFeedbackRatings as $rating ) {
@@ -209,6 +217,7 @@
210218 'pageid' => 'Page ID to submit feedback for',
211219 'revid' => 'Revision ID to submit feedback for',
212220 'anontoken' => 'Token for anonymous users',
 221+ 'bucket' => 'Which rating widget was shown to the user'
213222 );
214223 foreach( $wgArticleFeedbackRatings as $rating ) {
215224 $ret["r{$rating}"] = "Rating {$rating}";

Status & tagging log