Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/295603

Change subject: Make sure, that "Prompt me when entering a blank edit summary" 
works with Hooks
......................................................................

Make sure, that "Prompt me when entering a blank edit summary" works with Hooks

Currently, if an extension aborts the save of an edit (e.g. ConfirmEdit or
AbufeFilter), they add a message to resubmit the form (e.g. with the correct
CAPTCHA or after reading an information message). In this case, and in case
that the user activated the "Prompt me when entering a blank edit summary"
option, MediaWiki will ask to provide an edit summary or re-submit the form
to save the edit without a summary. After clicking submit again, an extension
maybe aborts the edit again (for the same reason as for the first time), and
the user need to re-submit the form again. After the submit, MediaWiki will ask
for the edit summary again. The user only sees this loop.

The cause is, that MediaWiki doesn't know, that the edit summary warning was
acknowledged by the user already. This commit changes how the 
wpIgnoreBlankSummary
hidden field is added to the form output. It now is added, if the 
wpIgnoreBlankSummary
form field was already set in the request. This is only the case, if the user 
already
clicked the save button again (after seeing the edit notice).

Bug: T12729
Change-Id: I53a6cf277f77e033d4b75e64731fd37b46c3926e
---
M includes/EditPage.php
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/03/295603/1

diff --git a/includes/EditPage.php b/includes/EditPage.php
index 3292f70..39c4877 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2480,7 +2480,7 @@
         * use the EditPage::showEditForm:fields hook instead.
         */
        function showEditForm( $formCallback = null ) {
-               global $wgOut, $wgUser;
+               global $wgOut, $wgUser, $wgRequest;
 
                # need to parse the preview early so that we know which 
templates are used,
                # otherwise users with "show preview after edit box" will get a 
blank list
@@ -2593,7 +2593,11 @@
                # ####
                # For a bit more sophisticated detection of blank summaries, 
hash the
                # automatic one and pass that in the hidden field wpAutoSummary.
-               if ( $this->missingSummary || ( $this->section == 'new' && 
$this->nosummary ) ) {
+               if (
+                       $this->missingSummary ||
+                       $wgRequest->getBool( 'wpIgnoreBlankSummary' ) ||
+                       ( $this->section == 'new' && $this->nosummary )
+               ) {
                        $wgOut->addHTML( Html::hidden( 'wpIgnoreBlankSummary', 
true ) );
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/295603
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53a6cf277f77e033d4b75e64731fd37b46c3926e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to