Merge "Fix duplicate wikitext parse for displaytitle"

This commit is contained in:
jenkins-bot 2014-12-09 22:54:37 +00:00 committed by Gerrit Code Review
commit 54b938e629
2 changed files with 11 additions and 11 deletions

View file

@ -186,7 +186,7 @@ class ApiVisualEditor extends ApiBase {
$apiParams = array(
'action' => 'parse',
'page' => $title->getPrefixedDBkey(),
'prop' => 'text|revid|categorieshtml',
'prop' => 'text|revid|categorieshtml|displaytitle',
);
$api = new ApiMain(
new DerivativeRequest(
@ -205,16 +205,25 @@ class ApiVisualEditor extends ApiBase {
$links = isset( $result['parse']['links'] ) ? $result['parse']['links'] : array();
$revision = Revision::newFromId( $result['parse']['revid'] );
$timestamp = $revision ? $revision->getTimestamp() : wfTimestampNow();
$displaytitle = isset( $result['parse']['displaytitle'] ) ?
$result['parse']['displaytitle'] : false;
if ( $content === false || ( strlen( $content ) && $revision === null ) ) {
return false;
}
if ( $displaytitle !== false ) {
// Escape entities as in OutputPage::setPageTitle()
$displaytitle = Sanitizer::normalizeCharReferences(
Sanitizer::removeHTMLtags( $displaytitle ) );
}
return array(
'content' => $content,
'categorieshtml' => $categorieshtml,
'basetimestamp' => $timestamp,
'starttimestamp' => wfTimestampNow()
'starttimestamp' => wfTimestampNow(),
'displayTitleHtml' => $displaytitle
);
}

View file

@ -147,15 +147,6 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
$view->displayTag();
}
$result['contentSub'] = $this->getOutput()->getSubtitle();
$content = new WikitextContent( $wikitext );
$parserOutput = $content->getParserOutput( $page );
if ( $parserOutput ) {
$result['displayTitleHtml'] = $parserOutput->getDisplayTitle();
} else {
wfDebug( '[VE] ApiVisualEditorEdit - parserOutput was false' );
}
$lang = $this->getLanguage();
if ( isset( $saveresult['edit']['newtimestamp'] ) ) {