IAlex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/50161
Change subject: Put the check for empty comment outside of the section anchor
section of EditPage::internalAttemptSave()
......................................................................
Put the check for empty comment outside of the section anchor section of
EditPage::internalAttemptSave()
Also reorganise checks for better clarity
Change-Id: Ib75b2c0b0c240459d58618eed283b547aaefd7f6
---
M includes/EditPage.php
1 file changed, 22 insertions(+), 25 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/61/50161/1
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 5434dab..8a3d630 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1561,43 +1561,40 @@
return $status;
}
- # Handle the user preference to force summaries here,
but not for null edits
- if ( $this->section != 'new' &&
!$this->allowBlankSummary
- && !$content->equals(
$this->getOriginalContent() )
- && !$content->isRedirect() ) # check if it's
not a redirect
- {
- if ( md5( $this->summary ) == $this->autoSumm )
{
- $this->missingSummary = true;
- $status->fatal( 'missingsummary' );
- $status->value =
self::AS_SUMMARY_NEEDED;
- wfProfileOut( __METHOD__ );
- return $status;
- }
- }
-
- # And a similar thing for new sections
- if ( $this->section == 'new' &&
!$this->allowBlankSummary ) {
- if ( trim( $this->summary ) == '' ) {
+ if ( $this->section == 'new' ) {
+ // Handle the user preference to force
summaries here
+ if ( !$this->allowBlankSummary && trim(
$this->summary ) == '' ) {
$this->missingSummary = true;
$status->fatal( 'missingsummary' ); //
or 'missingcommentheader' if $section == 'new'. Blegh
$status->value =
self::AS_SUMMARY_NEEDED;
wfProfileOut( __METHOD__ );
return $status;
}
+
+ // Do not allow the user to post an empty
comment
+ if ( $this->textbox1 == '' ) {
+ $this->missingComment = true;
+ $status->fatal( 'missingcommenttext' );
+ $status->value = self::AS_TEXTBOX_EMPTY;
+ wfProfileOut( __METHOD__ );
+ return $status;
+ }
+ } elseif ( !$this->allowBlankSummary
+ && !$content->equals(
$this->getOriginalContent() )
+ && !$content->isRedirect()
+ && md5( $this->summary ) == $this->autoSumm
+ ) {
+ $this->missingSummary = true;
+ $status->fatal( 'missingsummary' );
+ $status->value = self::AS_SUMMARY_NEEDED;
+ wfProfileOut( __METHOD__ );
+ return $status;
}
# All's well
wfProfileIn( __METHOD__ . '-sectionanchor' );
$sectionanchor = '';
if ( $this->section == 'new' ) {
- if ( $this->textbox1 == '' ) {
- $this->missingComment = true;
- $status->fatal( 'missingcommenttext' );
- $status->value = self::AS_TEXTBOX_EMPTY;
- wfProfileOut( __METHOD__ .
'-sectionanchor' );
- wfProfileOut( __METHOD__ );
- return $status;
- }
if ( $this->sectiontitle !== '' ) {
$sectionanchor =
$wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle );
// If no edit summary was specified,
create one automatically from the section
--
To view, visit https://gerrit.wikimedia.org/r/50161
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib75b2c0b0c240459d58618eed283b547aaefd7f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits