From 6d4b92f930d8e06c74114ced1a27ff33e4e26a28 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 14 Nov 2018 17:08:45 -0800 Subject: [PATCH] EditPage: Add returntoquery parameter to anoneditwarning links It's important to send people back not just to the page they were editing, but to the actual edit action as well. Bug: T208989 Change-Id: I010145840da1ac93927db846872eaf9843116bd7 --- includes/EditPage.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 373f6d9bf6..1f17297c58 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3145,16 +3145,22 @@ ERROR; ); } elseif ( $user->isAnon() ) { if ( $this->formtype != 'preview' ) { + $returntoquery = array_diff_key( + $this->context->getRequest()->getValues(), + [ 'title' => true, 'returnto' => true, 'returntoquery' => true ] + ); $out->wrapWikiMsg( "
\n$1\n
", [ 'anoneditwarning', // Log-in link SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( [ - 'returnto' => $this->getTitle()->getPrefixedDBkey() + 'returnto' => $this->getTitle()->getPrefixedDBkey(), + 'returntoquery' => wfArrayToCgi( $returntoquery ), ] ), // Sign-up link SpecialPage::getTitleFor( 'CreateAccount' )->getFullURL( [ - 'returnto' => $this->getTitle()->getPrefixedDBkey() + 'returnto' => $this->getTitle()->getPrefixedDBkey(), + 'returntoquery' => wfArrayToCgi( $returntoquery ), ] ) ] ); -- 2.20.1