r86143 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86142‎ | r86143 | r86144 >
Date:22:11, 15 April 2011
Author:happy-melon
Status:resolved (Comments)
Tags:
Comment:
Follow-up r86041: fix redirect in PurgeAction, and pass query parameters through the form so they can be put back on to the redirect at the end.
Modified paths:
  • /trunk/phase3/includes/Action.php (modified) (history)
  • /trunk/phase3/includes/actions/PurgeAction.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/actions/PurgeAction.php
@@ -88,6 +88,6 @@
8989 }
9090
9191 public function onSuccess() {
92 - $this->getOutput()->redirect( $this->getTitle() );
 92+ $this->getOutput()->redirect( $this->getTitle()->getFullUrl( $this->getRequest()->getVal( 'redirectparams', '' ) ) );
9393 }
9494 }
Index: trunk/phase3/includes/Action.php
@@ -285,8 +285,15 @@
286286
287287 $form = new HTMLForm( $this->fields, $this->getContext() );
288288 $form->setSubmitCallback( array( $this, 'onSubmit' ) );
289 - $form->addHiddenField( 'action', $this->getName() );
290289
 290+ // Retain query parameters (uselang etc)
 291+ $form->addHiddenField( 'action', $this->getName() ); // Might not be the same as the query string
 292+ $params = array_diff_key(
 293+ $this->getRequest()->getQueryValues(),
 294+ array( 'action' => null, 'title' => null )
 295+ );
 296+ $form->addHiddenField( 'redirectparams', wfArrayToCGI( $params ) );
 297+
291298 $form->addPreText( $this->preText() );
292299 $form->addPostText( $this->postText() );
293300 $this->alterForm( $form );

Sign-offs

UserFlagDate
Nikerabbittested07:14, 16 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r86412Follow-up r86143: retain query parameters for quick-purge as well as for the ...happy-melon16:20, 19 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86041r86001, now with less scariness :P I took out the delete action and did purg...happy-melon10:38, 14 April 2011

Comments

#Comment by Bawolff (talk | contribs)   22:17, 15 April 2011

This does not seem to keep query parameters if the user is logged in and not shown the form... (Not sure if that's intended for a later follow-up or if its accidental)

#Comment by Nikerabbit (talk | contribs)   07:14, 16 April 2011

Yep, parameters are not kept when logged in, but at least the redirection works now :)

#Comment by Happy-melon (talk | contribs)   16:20, 19 April 2011

Fixed in r86412.

#Comment by Catrope (talk | contribs)   21:41, 18 July 2011

Untagging revert1.18, this was fixed in trunk at the time that 1.18 was rebranched.

Status & tagging log