mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 02:38:40 +00:00
Update "page was last modified on date, at time" footer line when saving
Bug: 52403 Change-Id: I11e00066000e927f0551691d05fe11fe2ae125b0
This commit is contained in:
parent
7336a17cd3
commit
b2af92870a
|
@ -133,6 +133,14 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
wfDebug( '[VE] ApiVisualEditorEdit - parserOutput was false' );
|
||||
}
|
||||
|
||||
$lang = $this->getLanguage();
|
||||
$ts = $saveresult['edit']['newtimestamp'];
|
||||
|
||||
$result['lastModified'] = array(
|
||||
'date' => $lang->userDate( $ts, $user ),
|
||||
'time' => $lang->userTime( $ts, $user )
|
||||
);
|
||||
|
||||
if ( isset( $saveresult['edit']['newrevid'] ) ) {
|
||||
$result['newrevid'] = intval( $saveresult['edit']['newrevid'] );
|
||||
}
|
||||
|
|
|
@ -215,6 +215,7 @@ $wgResourceModules += array(
|
|||
// MW core messages
|
||||
'creating',
|
||||
'editing',
|
||||
'lastmodifiedat',
|
||||
'parentheses',
|
||||
'redirectpagesub',
|
||||
'spamprotectionmatch',
|
||||
|
|
|
@ -439,8 +439,11 @@ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () {
|
|||
* @param {number} newid New revision id, undefined if unchanged
|
||||
* @param {boolean} isRedirect Whether this page is a redirect or not
|
||||
* @param {string} displayTitle What HTML to show as the page title
|
||||
* @param {Object} lastModified Object containing user-formatted date and time strings
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.onSave = function ( html, categoriesHtml, newid, isRedirect, displayTitle ) {
|
||||
ve.init.mw.ViewPageTarget.prototype.onSave = function (
|
||||
html, categoriesHtml, newid, isRedirect, displayTitle, lastModified
|
||||
) {
|
||||
var newUrlParams, watchChecked;
|
||||
this.saveDeferred.resolve();
|
||||
if ( !this.pageExists || this.restoring ) {
|
||||
|
@ -482,7 +485,7 @@ ve.init.mw.ViewPageTarget.prototype.onSave = function ( html, categoriesHtml, ne
|
|||
this.revid = newid;
|
||||
}
|
||||
this.saveDialog.reset();
|
||||
this.replacePageContent( html, categoriesHtml, isRedirect, displayTitle );
|
||||
this.replacePageContent( html, categoriesHtml, isRedirect, displayTitle, lastModified );
|
||||
this.setupSectionEditLinks();
|
||||
this.tearDownBeforeUnloadHandler();
|
||||
this.deactivate( true );
|
||||
|
@ -1521,10 +1524,19 @@ ve.init.mw.ViewPageTarget.prototype.onWindowPopState = function ( e ) {
|
|||
* @param {string} categoriesHtml Rendered categories HTML from server
|
||||
* @param {boolean} isRedirect Whether this page is a redirect or not
|
||||
* @param {string} displayTitle What HTML to show as the page title
|
||||
* @param {Object} lastModified Object containing user-formatted date and time strings
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, categoriesHtml, isRedirect, displayTitle ) {
|
||||
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function (
|
||||
html, categoriesHtml, isRedirect, displayTitle, lastModified
|
||||
) {
|
||||
var $content = $( $.parseHTML( html ) ), $editableContent;
|
||||
|
||||
$( '#footer-info-lastmod' ).text( ' ' + mw.msg(
|
||||
'lastmodifiedat',
|
||||
lastModified.date,
|
||||
lastModified.time
|
||||
) );
|
||||
|
||||
if ( $( '#mw-imagepage-content' ).length ) {
|
||||
// On file pages, we only want to replace the (local) description.
|
||||
$editableContent = $( '#mw-imagepage-content' );
|
||||
|
|
|
@ -563,7 +563,8 @@ ve.init.mw.Target.onSave = function ( doc, saveData, response ) {
|
|||
data.categorieshtml,
|
||||
data.newrevid,
|
||||
data.isRedirect,
|
||||
data.displayTitleHtml
|
||||
data.displayTitleHtml,
|
||||
data.lastModified
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue