From f80b02944478cae40899b3d700612e3cf868cb4f Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sat, 7 Jul 2018 22:58:25 +0100 Subject: [PATCH] Fix doc in GalleryDialog and add todo Change-Id: I4e1ad8ec3d7a1c85a600bf1dafc449054c115203 --- modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 0007912416..d3879e88a7 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -643,7 +643,7 @@ ve.ui.MWGalleryDialog.prototype.onRequestImagesSuccess = function ( response ) { /** * Request a new image and highlight it * - * @param {string} title File name for the new image + * @param {string} title Normalized title of the new image */ ve.ui.MWGalleryDialog.prototype.addNewImage = function ( title ) { var dialog = this; @@ -683,6 +683,8 @@ ve.ui.MWGalleryDialog.prototype.updateHighlightedItem = function () { ve.ui.MWGalleryDialog.prototype.onSearchResultsChoose = function ( item ) { var title = mw.Title.newFromText( item.getData().title ).getPrefixedText(); + // Check title against pending insertions + // TODO: Prevent two 'choose' events firing from the UI if ( !Object.prototype.hasOwnProperty.call( this.selectedFilenames, title ) ) { this.addNewImage( title ); }