Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/65291
Change subject: Display 'editingold' as a notice when editing old version of a
page
......................................................................
Display 'editingold' as a notice when editing old version of a page
Bug: 47683
Change-Id: I216cdd68014173aa65cad42ddd3d870334be9ead
---
M ApiVisualEditor.php
1 file changed, 15 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/91/65291/1
diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 63ebe33..941190d 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -12,6 +12,9 @@
protected function getHTML( $title, $parserParams ) {
global $wgVisualEditorParsoidURL, $wgVisualEditorParsoidPrefix,
$wgVisualEditorParsoidTimeout;
+
+ $restoring = false;
+
if ( $title->exists() ) {
if ( $parserParams['oldid'] === 0 ) {
$parserParams['oldid'] = ''; // Parsoid wants
empty string rather than zero
@@ -20,6 +23,8 @@
if ( $revision === null ) {
return false;
}
+ $restoring = !$revision->isCurrent();
+
$parserParams['touched'] = $title->getTouched();
$parserParams['cache'] = 1;
@@ -59,9 +64,12 @@
$timestamp = wfTimestampNow();
}
return array(
- 'content' => $content,
- 'basetimestamp' => $timestamp,
- 'starttimestamp' => wfTimestampNow()
+ 'result' => array(
+ 'content' => $content,
+ 'basetimestamp' => $timestamp,
+ 'starttimestamp' => wfTimestampNow(),
+ ),
+ 'restoring' => $restoring,
);
}
@@ -232,6 +240,9 @@
if ( $user->isAnon() ) {
$wgVisualEditorEditNotices[] =
'anoneditwarning';
}
+ if ( $parsed && $parsed['restoring'] ) {
+ $wgVisualEditorEditNotices[] =
'editingold';
+ }
if ( count( $wgVisualEditorEditNotices ) ) {
foreach ( $wgVisualEditorEditNotices as
$key ) {
$notices[] = wfMessage( $key
)->parseAsBlock();
@@ -241,7 +252,7 @@
$this->dieUsage( 'Error contacting the
Parsoid server', 'parsoidserver' );
} else {
$result = array_merge(
- array( 'result' => 'success',
'notices' => $notices ), $parsed
+ array( 'result' => 'success',
'notices' => $notices ), $parsed['result']
);
}
break;
--
To view, visit https://gerrit.wikimedia.org/r/65291
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I216cdd68014173aa65cad42ddd3d870334be9ead
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits