r72531 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72530‎ | r72531 | r72532 >
Date:12:10, 7 September 2010
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
ApiArticleAssessment:

*Mark as mustBePosted
*Drop aa prefix (ArticleAssessment.js updated to match)
*Use $dbw->timestamp()
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php (modified) (history)
  • /trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php
@@ -1,7 +1,7 @@
22 <?php
33 class ApiArticleAssessment extends ApiBase {
44 public function __construct( $query, $moduleName ) {
5 - parent::__construct( $query, $moduleName, 'aa' );
 5+ parent::__construct( $query, $moduleName, '' );
66 }
77
88 public function execute() {
@@ -118,6 +118,8 @@
119119 */
120120 private function insertUserRatings( $pageId, $revisionId, $user, $token, $ratingId, $ratingValue ) {
121121 $dbw = wfGetDB( DB_MASTER );
 122+
 123+ $timestamp = $dbw->timestamp();
122124
123125 $res = $dbw->insert(
124126 'article_assessment',
@@ -127,7 +129,7 @@
128130 'aa_user_id' => $user->getId(),
129131 'aa_user_text' => $user->getName(),
130132 'aa_revision' => $revisionId,
131 - 'aa_timestamp' => wfTimestampNow(),
 133+ 'aa_timestamp' => $timestamp,
132134 'aa_rating_id' => $ratingId,
133135 'aa_rating_value' => $ratingValue,
134136 ),
@@ -141,7 +143,7 @@
142144 $dbw->update(
143145 'article_assessment',
144146 array(
145 - 'aa_timestamp' => wfTimestampNow(),
 147+ 'aa_timestamp' => $timestamp,
146148 'aa_rating_value' => $ratingValue,
147149 ),
148150 array_merge(
@@ -202,6 +204,10 @@
203205 'Submit article assessments'
204206 );
205207 }
 208+
 209+ public function mustBePosted() {
 210+ return true;
 211+ }
206212
207213 public function isWriteMode() {
208214 return true;
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js
@@ -275,13 +275,13 @@
276276 url: wgScriptPath + '/api.php',
277277 data: {
278278 'action': 'articleassessment',
279 - 'aarevid': config.revID,
280 - 'aapageid': config.pageID,
281 - 'aar1' : results['wellsourced'],
282 - 'aar2' : results['neutrality'],
283 - 'aar3' : results['completeness'],
284 - 'aar4' : results['readability'],
285 - 'aaanontoken': config.userID,
 279+ 'revid': config.revID,
 280+ 'pageid': config.pageID,
 281+ 'r1' : results['wellsourced'],
 282+ 'r2' : results['neutrality'],
 283+ 'r3' : results['completeness'],
 284+ 'r4' : results['readability'],
 285+ 'anontoken': config.userID,
286286 'format': 'json'
287287 },
288288 dataType: 'json',

Follow-up revisions

RevisionCommit summaryAuthorDate
r72557POST, followup r72531reedy22:25, 7 September 2010

Comments

#Comment by Catrope (talk | contribs)   20:21, 7 September 2010

Presumably the JS has to be changed to use POST?

Status & tagging log