mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Don't try to get newtimestamp from edit if no change was made
ApiEditPage can give us 'nochange' instead of the 'oldrevid'/'newrevid'/'newtimestamp' keys if we gave it a null edit. Bug: 73463 Change-Id: Ic22597dfed11de3823471673404090a9bce12928
This commit is contained in:
parent
fce0ed5d6c
commit
ff3d76f488
|
@ -153,12 +153,15 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang = $this->getLanguage();
|
$lang = $this->getLanguage();
|
||||||
$ts = $saveresult['edit']['newtimestamp'];
|
|
||||||
|
|
||||||
$result['lastModified'] = array(
|
if ( isset( $saveresult['edit']['newtimestamp'] ) ) {
|
||||||
'date' => $lang->userDate( $ts, $user ),
|
$ts = $saveresult['edit']['newtimestamp'];
|
||||||
'time' => $lang->userTime( $ts, $user )
|
|
||||||
);
|
$result['lastModified'] = array(
|
||||||
|
'date' => $lang->userDate( $ts, $user ),
|
||||||
|
'time' => $lang->userTime( $ts, $user )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $saveresult['edit']['newrevid'] ) ) {
|
if ( isset( $saveresult['edit']['newrevid'] ) ) {
|
||||||
$result['newrevid'] = intval( $saveresult['edit']['newrevid'] );
|
$result['newrevid'] = intval( $saveresult['edit']['newrevid'] );
|
||||||
|
|
|
@ -436,7 +436,8 @@ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () {
|
||||||
* @param {number} newid New revision id, undefined if unchanged
|
* @param {number} newid New revision id, undefined if unchanged
|
||||||
* @param {boolean} isRedirect Whether this page is a redirect or not
|
* @param {boolean} isRedirect Whether this page is a redirect or not
|
||||||
* @param {string} displayTitle What HTML to show as the page title
|
* @param {string} displayTitle What HTML to show as the page title
|
||||||
* @param {Object} lastModified Object containing user-formatted date and time strings
|
* @param {Object} lastModified Object containing user-formatted date
|
||||||
|
and time strings, or undefined if we made no change.
|
||||||
*/
|
*/
|
||||||
ve.init.mw.ViewPageTarget.prototype.onSave = function (
|
ve.init.mw.ViewPageTarget.prototype.onSave = function (
|
||||||
html, categoriesHtml, newid, isRedirect, displayTitle, lastModified, contentSub
|
html, categoriesHtml, newid, isRedirect, displayTitle, lastModified, contentSub
|
||||||
|
@ -1528,7 +1529,8 @@ ve.init.mw.ViewPageTarget.prototype.onWindowPopState = function ( e ) {
|
||||||
* @param {string} html Rendered HTML from server
|
* @param {string} html Rendered HTML from server
|
||||||
* @param {string} categoriesHtml Rendered categories HTML from server
|
* @param {string} categoriesHtml Rendered categories HTML from server
|
||||||
* @param {string} displayTitle What HTML to show as the page title
|
* @param {string} displayTitle What HTML to show as the page title
|
||||||
* @param {Object} lastModified Object containing user-formatted date and time strings
|
* @param {Object} lastModified Object containing user-formatted date
|
||||||
|
and time strings, or undefined if we made no change.
|
||||||
* @param {string} contentSub What HTML to show as the content subtitle
|
* @param {string} contentSub What HTML to show as the content subtitle
|
||||||
*/
|
*/
|
||||||
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function (
|
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function (
|
||||||
|
@ -1536,11 +1538,13 @@ ve.init.mw.ViewPageTarget.prototype.replacePageContent = function (
|
||||||
) {
|
) {
|
||||||
var $content = $( $.parseHTML( html ) ), $editableContent;
|
var $content = $( $.parseHTML( html ) ), $editableContent;
|
||||||
|
|
||||||
$( '#footer-info-lastmod' ).text( ' ' + mw.msg(
|
if ( lastModified ) {
|
||||||
'lastmodifiedat',
|
$( '#footer-info-lastmod' ).text( ' ' + mw.msg(
|
||||||
lastModified.date,
|
'lastmodifiedat',
|
||||||
lastModified.time
|
lastModified.date,
|
||||||
) );
|
lastModified.time
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( $( '#mw-imagepage-content' ).length ) {
|
if ( $( '#mw-imagepage-content' ).length ) {
|
||||||
// On file pages, we only want to replace the (local) description.
|
// On file pages, we only want to replace the (local) description.
|
||||||
|
|
Loading…
Reference in a new issue