DesktopArticleTarget: Only try to show notices if some exist

This avoids an OOui deprecation warning for trying to toggle a popup which
isn't connected to anything.

Bug: T160161
Change-Id: I9ad97785f0de4ecf81d189985459689644e25923
This commit is contained in:
David Lynch 2017-03-16 11:35:10 -05:00
parent cf94956fba
commit eb8ba26adf

View file

@ -1598,7 +1598,7 @@ ve.init.mw.DesktopArticleTarget.prototype.maybeShowMetaDialog = function () {
if ( this.welcomeDialogPromise ) {
this.welcomeDialogPromise
.always( function () {
var noticesTool, popup;
var noticesTool, popup, notices;
// Pop out the notices when the welcome dialog is closed
if (
target.switched &&
@ -1608,9 +1608,12 @@ ve.init.mw.DesktopArticleTarget.prototype.maybeShowMetaDialog = function () {
target.actionsToolbar.tools.editModeSource.toolGroup.$element.append( popup.$element );
popup.toggle( true );
} else {
noticesTool = target.actionsToolbar.tools.notices;
noticesTool.setNotices( target.getEditNotices() );
noticesTool.getPopup().toggle( true );
notices = target.getEditNotices();
if ( notices.length ) {
noticesTool = target.actionsToolbar.tools.notices;
noticesTool.setNotices( notices );
noticesTool.getPopup().toggle( true );
}
}
} );
}