r104467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104466‎ | r104467 | r104468 >
Date:18:55, 28 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r104064, r104083 for bug 32609

Do the same for LiquidThreads

Remove captcha stuff from ApiThreadAction

Make ApiThreadAction subclass ApiEditPage (for ease), so the calls in ConfirmEdit ( "if ( !$module instanceof ApiEditPage ) {") will be picked up by it

Also gives the benefit of the captcha variables getting the descriptions from ConfirmEdit, rather than being blank like they currently are
Modified paths:
  • /trunk/extensions/LiquidThreads/api/ApiThreadAction.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/api/ApiThreadAction.php
@@ -1,6 +1,6 @@
22 <?php
33
4 -class ApiThreadAction extends ApiBase {
 4+class ApiThreadAction extends ApiEditPage {
55
66 public function execute() {
77 $params = $this->extractRequestParams();
@@ -108,7 +108,7 @@
109109 }
110110
111111 $thread = array_pop( $threads );
112 -
 112+
113113 global $wgUser;
114114 $errors = $thread->title()->getUserPermissionsErrors( 'lqt-split', $wgUser );
115115 if ( $errors ) {
@@ -182,14 +182,7 @@
183183 $article = new Article( $title, 0 );
184184 $newParent = Threads::withRoot( $article );
185185 }
186 -
187 - if ( isset($params['captchaword']) ) {
188 - $requestData['captchaword'] = $params['captchaword'];
189 - }
190 - if ( isset($params['captchaid']) ) {
191 - $requestData['captchaid'] = $params['captchaid'];
192 - }
193 -
 186+
194187 global $wgUser;
195188 $errors = $newParent->title()->getUserPermissionsErrors( 'lqt-merge', $wgUser );
196189 if ( $errors ) {
@@ -308,14 +301,6 @@
309302 if ( $wgUser->isAllowed('bot') ) {
310303 $requestData['bot'] = true;
311304 }
312 -
313 - if ( $params['captchaword'] !== null ) {
314 - $requestData['captchaword'] = $params['captchaword'];
315 - }
316 -
317 - if ( $params['captchaid'] !== null ) {
318 - $requestData['captchaid'] = $params['captchaid'];
319 - }
320305
321306 $editReq = new FauxRequest( $requestData, true );
322307 LqtView::fixFauxRequestSession( $editReq );
@@ -436,14 +421,6 @@
437422 if ( $wgUser->isAllowed('bot') ) {
438423 $requestData['bot'] = true;
439424 }
440 -
441 - if ( $params['captchaword'] !== null ) {
442 - $requestData['captchaword'] = $params['captchaword'];
443 - }
444 -
445 - if ( $params['captchaid'] !== null ) {
446 - $requestData['captchaid'] = $params['captchaid'];
447 - }
448425
449426 $editReq = new FauxRequest( $requestData, true );
450427 LqtView::fixFauxRequestSession( $editReq );
@@ -561,14 +538,6 @@
562539 if ( $wgUser->isAllowed('bot') ) {
563540 $requestData['bot'] = true;
564541 }
565 -
566 - if ( $params['captchaword'] !== null ) {
567 - $requestData['captchaword'] = $params['captchaword'];
568 - }
569 -
570 - if ( $params['captchaid'] !== null ) {
571 - $requestData['captchaid'] = $params['captchaid'];
572 - }
573542
574543 $editReq = new FauxRequest( $requestData, true );
575544 LqtView::fixFauxRequestSession( $editReq );
@@ -650,7 +619,7 @@
651620 'no-specified-threads' );
652621 }
653622 $thread = array_pop( $threads );
654 -
 623+
655624 global $wgUser;
656625 $errors = $thread->title()->getUserPermissionsErrors( 'edit', $wgUser );
657626 if ( $errors ) {
@@ -729,14 +698,14 @@
730699 }
731700
732701 $thread = array_pop( $threads );
733 -
 702+
734703 global $wgUser;
735704 $errors = $thread->title()->getUserPermissionsErrors( 'edit', $wgUser );
736705 if ( $errors ) {
737706 // We don't care about multiple errors, just report one of them
738707 $this->dieUsageMsg( reset( $errors ) );
739708 }
740 -
 709+
741710 $thread->setSortkey( $ts );
742711 $thread->commitRevision( Threads::CHANGE_ADJUSTED_SORTKEY, null, $reason );
743712
@@ -849,7 +818,7 @@
850819
851820 $result = array( 'inlineeditform' => array( 'html' => $output ) );
852821
853 - /* FIXME
 822+ /* FIXME
854823 $result['resources'] = LqtView::getJSandCSS();
855824 $result['resources']['messages'] = LqtView::exportJSLocalisation();
856825 */
@@ -971,8 +940,6 @@
972941 'method' => null,
973942 'operand' => null,
974943 'gettoken' => null,
975 - 'captchaword' => null,
976 - 'captchaid' => null,
977944 );
978945 }
979946

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104064* (bug 32609) API: Move captchaid/captchaword of action=edit from core to Cap...reedy19:09, 23 November 2011
r104083Fix hook copy paste fail...reedy20:37, 23 November 2011

Status & tagging log