r98041 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98040‎ | r98041 | r98042 >
Date:22:14, 24 September 2011
Author:aaron
Status:ok
Tags:
Comment:
Made ApiReviewActivity.php require an edit token
Modified paths:
  • /trunk/extensions/FlaggedRevs/api/actions/ApiReviewActivity.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/modules/review.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/api/actions/ApiReviewActivity.php
@@ -102,7 +102,8 @@
103103 return array(
104104 'previd' => null,
105105 'oldid' => null,
106 - 'reviewing' => array( ApiBase::PARAM_TYPE => array( 0, 1 ) )
 106+ 'reviewing' => array( ApiBase::PARAM_TYPE => array( 0, 1 ) ),
 107+ 'token' => null,
107108 );
108109 }
109110
@@ -111,6 +112,7 @@
112113 'previd' => 'The prior revision ID (for reviewing changes only)',
113114 'oldid' => 'The ID of the revision being reviewed',
114115 'reviewing' => 'Whether to advertising as reviewing or no longer reviewing',
 116+ 'token' => 'A token previously obtained through the gettoken parameter or prop=info',
115117 );
116118 }
117119
@@ -130,11 +132,11 @@
131133 }
132134
133135 public function needsToken() {
134 - return false;
 136+ return true;
135137 }
136138
137 - public function getTokenSalt() {
138 - return false;
 139+ public function getTokenSalt() {
 140+ return '';
139141 }
140142
141143 public function getExamples() {
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.js
@@ -387,7 +387,9 @@
388388 action : 'reviewactivity',
389389 previd : oRevId,
390390 oldid : nRevId,
391 - reviewing : value
 391+ reviewing : value,
 392+ token : mw.user.tokens.get('editToken'),
 393+ format : 'json'
392394 },
393395 type : "POST",
394396 dataType: "html", // response type
@@ -396,11 +398,13 @@
397399 });
398400 }
399401 if ( call.status == 200 ) {
400 - FlaggedRevsReview.isUserReviewing = value;
401 - return true;
402 - } else {
403 - return false;
 402+ var s = jQuery.parseJSON( call.responseText );
 403+ if ( s && s.reviewactivity && s.reviewactivity.result == "Success" ) {
 404+ FlaggedRevsReview.isUserReviewing = value;
 405+ return true;
 406+ }
404407 }
 408+ return false;
405409 }
406410 };
407411

Sign-offs

UserFlagDate
Krinkleinspected18:58, 3 October 2011

Status & tagging log