From: Rob Church Date: Sat, 25 Mar 2006 00:57:14 +0000 (+0000) Subject: (bug 4630) Add user preference to prompt users when entering blank edit summaries X-Git-Tag: 1.6.0~137 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=669b5bd08c70060b1b77ce52e2743deb93d4bf4b;p=lhc%2Fweb%2Fwiklou.git (bug 4630) Add user preference to prompt users when entering blank edit summaries --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 857b0902c5..1fd664a205 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -714,6 +714,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 5286) Fix regression in display of missing/bad revision IDs * (bug 4729) Add user preference that marks a user's edits as patrolled if user is able to * (bug 4497,4704,5010) Added some new language codes. +* (bug 4630) Add user preference to prompt users when entering blank edit summaries === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index b47dce7df2..18e99cd29f 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -27,6 +27,8 @@ class EditPage { var $tooBig = false; var $kblength = false; var $missingComment = false; + var $missingSummary = false; + var $allowBlankSummary = false; # Form values var $save = false, $preview = false, $diff = false; @@ -381,6 +383,8 @@ class EditPage { $this->minoredit = $request->getCheck( 'wpMinoredit' ); $this->watchthis = $request->getCheck( 'wpWatchthis' ); + $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ); + } else { # Not a posted form? Start with nothing. wfDebug( "$fname: Not a posted form.\n" ); @@ -627,6 +631,13 @@ class EditPage { return true; } + # Handle the user preference to force summaries here + if( trim( $this->summary ) == '' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary' ) ) { + $this->missingSummary = true; + wfProfileOut( $fname ); + return( true ); + } + # All's well wfProfileIn( "$fname-sectionanchor" ); $sectionanchor = ''; @@ -744,6 +755,10 @@ class EditPage { if ( $this->missingComment ) { $wgOut->addWikiText( wfMsg( 'missingcommenttext' ) ); } + + if( $this->missingSummary ) { + $wgOut->addWikiText( wfMsg( 'missingsummary' ) ); + } if ( !$this->checkUnicodeCompliantBrowser() ) { $wgOut->addWikiText( wfMsg( 'nonunicodebrowser') ); @@ -1055,6 +1070,12 @@ END $wgOut->addHTML( "\n\n" ); } + # If there's no summary, slip in a hidden tag here + # If the user doesn't want to provide one, hitting Save a second time will cause it to go + # through without further hassle + if( $this->missingSummary ) { + $wgOut->addHTML( "\n" ); + } if ( $this->isConflict ) { require_once( "DifferenceEngine.php" ); diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 7af9b26fa6..16a176fe0c 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -818,8 +818,9 @@ class PreferencesForm { 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, - $wgUser->isAllowed( 'patrol' ) ? 'autopatrol' : false, ) - ) . '' + $wgUser->isAllowed( 'patrol' ) ? 'autopatrol' : false, + 'forceeditsummary', + ) ) . '' ); $this->mUsedToggles['autopatrol'] = true; # Don't show this up for users who can't; the handler below is dumb and doesn't know it diff --git a/languages/Language.php b/languages/Language.php index c7e853d3c7..3eb8fa2a8f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -160,6 +160,7 @@ $wgDateFormatsEn = array( 'showjumplinks', 'uselivepreview', 'autopatrol', + 'forceeditsummary', ); /* private */ $wgBookstoreListEn = array( diff --git a/languages/Messages.php b/languages/Messages.php index 5372650d75..821adc4566 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -62,6 +62,7 @@ parent class in order maintain consistency across languages. 'tog-showjumplinks' => 'Enable "jump to" accessibility links', 'tog-uselivepreview' => 'Use live preview (JavaScript) (Experimental)', 'tog-autopatrol' => 'Mark edits you make as patrolled', +'tog-forceeditsummary' => 'Prompt me when entering a blank edit summary', 'underline-always' => 'Always', 'underline-never' => 'Never', @@ -456,6 +457,7 @@ format. Please enter a well-formatted address or empty that field.', 'showlivepreview' => 'Live preview', 'showdiff' => 'Show changes', 'anoneditwarning' => 'You are not logged in. Your IP address will be recorded in this page\'s edit history.', +'missingsummary' => "'''Reminder:''' You have not provided an edit summary. If you click Save again, your edit will be saved without one.", 'missingcommenttext' => 'Please enter a comment below.', 'blockedtitle' => 'User is blocked', 'blockedtext' => 'Your user name or IP address has been blocked by $1.