If user is anonymous, mw.page.watch is not loaded. Only call

method if module is loaded.

Change-Id: Ieb549b701f05f1dab322baa79d59366225f42727
This commit is contained in:
Rob Moen 2012-06-20 16:20:17 -07:00
parent 5968991d25
commit 4b8833942c

View file

@ -191,14 +191,17 @@ ve.init.ViewPageTarget.prototype.onSave = function( html ) {
// This is a page creation, refresh the page
window.location.href = this.viewUri;
} else {
// Update the watch link to match the state of 'watch checkbox' in save dialog
var watchPage = this.$saveDialog
.find( '#ve-init-viewPageTarget-saveDialog-watchList')
.prop( 'checked' );
mw.page.watch.updateWatchLink(
$('#ca-watch a, #ca-unwatch a'),
watchPage === true ? 'unwatch': 'watch'
);
// Update watch link to match 'watch checkbox' in save dialog.
// User logged in if module loaded.
if ( mw.page.watch !== undefined ) {
var watchPage = this.$saveDialog
.find( '#ve-init-viewPageTarget-saveDialog-watchList')
.prop( 'checked' );
mw.page.watch.updateWatchLink(
$('#ca-watch a, #ca-unwatch a'),
watchPage === true ? 'unwatch': 'watch'
);
}
this.hideSaveDialog();
this.resetSaveDialog();
this.replacePageContent( html );