Index: trunk/extensions/LiquidThreads/api/ApiThreadAction.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -class ApiThreadAction extends ApiBase { |
| 4 | +class ApiThreadAction extends ApiEditPage { |
5 | 5 | |
6 | 6 | public function execute() { |
7 | 7 | $params = $this->extractRequestParams(); |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | } |
110 | 110 | |
111 | 111 | $thread = array_pop( $threads ); |
112 | | - |
| 112 | + |
113 | 113 | global $wgUser; |
114 | 114 | $errors = $thread->title()->getUserPermissionsErrors( 'lqt-split', $wgUser ); |
115 | 115 | if ( $errors ) { |
— | — | @@ -182,14 +182,7 @@ |
183 | 183 | $article = new Article( $title, 0 ); |
184 | 184 | $newParent = Threads::withRoot( $article ); |
185 | 185 | } |
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 | + |
194 | 187 | global $wgUser; |
195 | 188 | $errors = $newParent->title()->getUserPermissionsErrors( 'lqt-merge', $wgUser ); |
196 | 189 | if ( $errors ) { |
— | — | @@ -308,14 +301,6 @@ |
309 | 302 | if ( $wgUser->isAllowed('bot') ) { |
310 | 303 | $requestData['bot'] = true; |
311 | 304 | } |
312 | | - |
313 | | - if ( $params['captchaword'] !== null ) { |
314 | | - $requestData['captchaword'] = $params['captchaword']; |
315 | | - } |
316 | | - |
317 | | - if ( $params['captchaid'] !== null ) { |
318 | | - $requestData['captchaid'] = $params['captchaid']; |
319 | | - } |
320 | 305 | |
321 | 306 | $editReq = new FauxRequest( $requestData, true ); |
322 | 307 | LqtView::fixFauxRequestSession( $editReq ); |
— | — | @@ -436,14 +421,6 @@ |
437 | 422 | if ( $wgUser->isAllowed('bot') ) { |
438 | 423 | $requestData['bot'] = true; |
439 | 424 | } |
440 | | - |
441 | | - if ( $params['captchaword'] !== null ) { |
442 | | - $requestData['captchaword'] = $params['captchaword']; |
443 | | - } |
444 | | - |
445 | | - if ( $params['captchaid'] !== null ) { |
446 | | - $requestData['captchaid'] = $params['captchaid']; |
447 | | - } |
448 | 425 | |
449 | 426 | $editReq = new FauxRequest( $requestData, true ); |
450 | 427 | LqtView::fixFauxRequestSession( $editReq ); |
— | — | @@ -561,14 +538,6 @@ |
562 | 539 | if ( $wgUser->isAllowed('bot') ) { |
563 | 540 | $requestData['bot'] = true; |
564 | 541 | } |
565 | | - |
566 | | - if ( $params['captchaword'] !== null ) { |
567 | | - $requestData['captchaword'] = $params['captchaword']; |
568 | | - } |
569 | | - |
570 | | - if ( $params['captchaid'] !== null ) { |
571 | | - $requestData['captchaid'] = $params['captchaid']; |
572 | | - } |
573 | 542 | |
574 | 543 | $editReq = new FauxRequest( $requestData, true ); |
575 | 544 | LqtView::fixFauxRequestSession( $editReq ); |
— | — | @@ -650,7 +619,7 @@ |
651 | 620 | 'no-specified-threads' ); |
652 | 621 | } |
653 | 622 | $thread = array_pop( $threads ); |
654 | | - |
| 623 | + |
655 | 624 | global $wgUser; |
656 | 625 | $errors = $thread->title()->getUserPermissionsErrors( 'edit', $wgUser ); |
657 | 626 | if ( $errors ) { |
— | — | @@ -729,14 +698,14 @@ |
730 | 699 | } |
731 | 700 | |
732 | 701 | $thread = array_pop( $threads ); |
733 | | - |
| 702 | + |
734 | 703 | global $wgUser; |
735 | 704 | $errors = $thread->title()->getUserPermissionsErrors( 'edit', $wgUser ); |
736 | 705 | if ( $errors ) { |
737 | 706 | // We don't care about multiple errors, just report one of them |
738 | 707 | $this->dieUsageMsg( reset( $errors ) ); |
739 | 708 | } |
740 | | - |
| 709 | + |
741 | 710 | $thread->setSortkey( $ts ); |
742 | 711 | $thread->commitRevision( Threads::CHANGE_ADJUSTED_SORTKEY, null, $reason ); |
743 | 712 | |
— | — | @@ -849,7 +818,7 @@ |
850 | 819 | |
851 | 820 | $result = array( 'inlineeditform' => array( 'html' => $output ) ); |
852 | 821 | |
853 | | - /* FIXME |
| 822 | + /* FIXME |
854 | 823 | $result['resources'] = LqtView::getJSandCSS(); |
855 | 824 | $result['resources']['messages'] = LqtView::exportJSLocalisation(); |
856 | 825 | */ |
— | — | @@ -971,8 +940,6 @@ |
972 | 941 | 'method' => null, |
973 | 942 | 'operand' => null, |
974 | 943 | 'gettoken' => null, |
975 | | - 'captchaword' => null, |
976 | | - 'captchaid' => null, |
977 | 944 | ); |
978 | 945 | } |
979 | 946 | |