"Catrope" changed the status of MediaWiki.r106754 to "resolved" and commented
it.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/106754#c28225
Old Status: new
> New Status: resolved
Commit summary for MediaWiki.r106754:
adding sectiontitle/wgSectionTitle as a new parameter for page editing (so that
it can be set separately from the edit summary). For right now, this is just
for API use, and thus isnt used in the form. As soon as 1.19 is out the door,
we should change the form to use this as well. The current implementation is
designed to be completely backward-compatible and non-disruptive
Catrope's comment:
<pre>
+ $this->sectiontitle = $wgLang->truncate(
$request->getText( 'wpSectionTitle' ), 250 );
</pre>
Why would you truncate sectiontitle to 250 chars? This makes sense for the
summary, but I don't see how it makes sense for the section title.
<pre>
+ if ( $this->section == 'new' ) {
+ if ( $this->sectiontitle != '' ) {
+ // Insert the section title above the
content.
+ $text = wfMsgForContent(
'newsectionheaderdefaultlevel', $this->sectiontitle ) . "\n\n" . $text;
+
+ // Jump to the new section
+ $result['sectionanchor'] =
$wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle );
+
+ // If no edit summary was specified,
create one automatically from the section
+ // title and have it link to the new
section. Otherwise, respect the summary as
+ // passed.
+ if ( $this->summary == '' ) {
+ $cleanSectionTitle =
$wgParser->stripSectionName( $this->sectiontitle );
+ $this->summary =
wfMsgForContent( 'newsectionsummary', $cleanSectionTitle );
+ }
+ } elseif ( $this->summary != '' ) {
+ // Insert the section title above the
content.
+ $text = wfMsgForContent(
'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text;
+
+ // Jump to the new section
+ $result['sectionanchor'] =
$wgParser->guessLegacySectionNameFromWikiText( $this->summary );
+ // Create a link to the new section
from the edit summary.
+ $cleanSummary =
$wgParser->stripSectionName( $this->summary );
+ $this->summary = wfMsgForContent(
'newsectionsummary', $cleanSummary );
+ }
</pre>
There is a lot of code duplication between the if and the else branch, can't
you condense this somehow?
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview