*
* If the option noBrackets is set the rollback link wont be enclosed in "[]".
*
- * See the "mediawiki.page.rollback" module for the client-side handling of this link.
- *
* @since 1.16.3. $context added in 1.20. $options added in 1.21
*
* @param Revision $rev
$inner = $context->msg( 'brackets' )->rawParams( $inner )->escaped();
}
- $context->getOutput()->addModules( 'mediawiki.page.rollback' );
-
return '<span class="mw-rollback-link">' . $inner . '</span>';
}
$query = [
'action' => 'rollback',
'from' => $rev->getUserText(),
+ 'token' => $context->getUser()->getEditToken( 'rollback' ),
];
$attrs = [
'data-mw' => 'interface',
*
* @ingroup Actions
*/
-class RollbackAction extends FormAction {
+class RollbackAction extends FormlessAction {
public function getName() {
return 'rollback';
return 'rollback';
}
- protected function preText() {
- return $this->msg( 'confirm-rollback-top' )->parse();
- }
-
- protected function alterForm( HTMLForm $form ) {
- $form->setSubmitTextMsg( 'confirm-rollback-button' );
- $form->setTokenSalt( 'rollback' );
-
- // Copy parameters from GET to confirmation form
- $from = $this->getRequest()->getVal( 'from' );
- if ( $from === null ) {
- throw new BadRequestError( 'rollbackfailed', 'rollback-missingparam' );
- }
- foreach ( [ 'from', 'bot', 'hidediff', 'summary' ] as $param ) {
- $val = $this->getRequest()->getVal( $param );
- if ( $val !== null ) {
- $form->addHiddenField( $param, $val );
- }
- }
- }
+ /**
+ * Temporarily unused message keys due to T88044/T136375:
+ * - confirm-rollback-top
+ * - confirm-rollback-button
+ * - rollbackfailed
+ * - rollback-missingparam
+ */
/**
- * This must return true so that HTMLForm::show() will not display the form again after
- * submission. For rollback, display either the form or the result (success/error)
- * not both.
- *
- * @return bool
* @throws ErrorPageError
*/
- public function onSubmit( $data ) {
- $this->useTransactionalTimeLimit();
+ public function onView() {
+ // TODO: use $this->useTransactionalTimeLimit(); when POST only
+ wfTransactionalTimeLimit();
$request = $this->getRequest();
$user = $this->getUser();
$errors = $this->page->doRollback(
$from,
$request->getText( 'summary' ),
- // Provided by HTMLForm
- $request->getVal( 'wpEditToken' ),
+ $request->getVal( 'token' ),
$request->getBool( 'bot' ),
$data,
$this->getUser()
return true;
}
- public function onSuccess() {
- // Required by parent class, but redundant because onSubmit already shows
- // the success message when needed.
- }
-
protected function getDescription() {
return '';
}