Index: trunk/extensions/FlaggedRevs/api/actions/ApiReviewActivity.php |
— | — | @@ -102,7 +102,8 @@ |
103 | 103 | return array( |
104 | 104 | 'previd' => null, |
105 | 105 | 'oldid' => null, |
106 | | - 'reviewing' => array( ApiBase::PARAM_TYPE => array( 0, 1 ) ) |
| 106 | + 'reviewing' => array( ApiBase::PARAM_TYPE => array( 0, 1 ) ), |
| 107 | + 'token' => null, |
107 | 108 | ); |
108 | 109 | } |
109 | 110 | |
— | — | @@ -111,6 +112,7 @@ |
112 | 113 | 'previd' => 'The prior revision ID (for reviewing changes only)', |
113 | 114 | 'oldid' => 'The ID of the revision being reviewed', |
114 | 115 | 'reviewing' => 'Whether to advertising as reviewing or no longer reviewing', |
| 116 | + 'token' => 'A token previously obtained through the gettoken parameter or prop=info', |
115 | 117 | ); |
116 | 118 | } |
117 | 119 | |
— | — | @@ -130,11 +132,11 @@ |
131 | 133 | } |
132 | 134 | |
133 | 135 | public function needsToken() { |
134 | | - return false; |
| 136 | + return true; |
135 | 137 | } |
136 | 138 | |
137 | | - public function getTokenSalt() { |
138 | | - return false; |
| 139 | + public function getTokenSalt() { |
| 140 | + return ''; |
139 | 141 | } |
140 | 142 | |
141 | 143 | public function getExamples() { |
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.js |
— | — | @@ -387,7 +387,9 @@ |
388 | 388 | action : 'reviewactivity', |
389 | 389 | previd : oRevId, |
390 | 390 | oldid : nRevId, |
391 | | - reviewing : value |
| 391 | + reviewing : value, |
| 392 | + token : mw.user.tokens.get('editToken'), |
| 393 | + format : 'json' |
392 | 394 | }, |
393 | 395 | type : "POST", |
394 | 396 | dataType: "html", // response type |
— | — | @@ -396,11 +398,13 @@ |
397 | 399 | }); |
398 | 400 | } |
399 | 401 | 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 | + } |
404 | 407 | } |
| 408 | + return false; |
405 | 409 | } |
406 | 410 | }; |
407 | 411 | |