From d9b9bf77fc4a2d118f090bcfa89b656ae8b4f3d6 Mon Sep 17 00:00:00 2001 From: Prateek Saxena Date: Thu, 28 Jun 2018 12:43:29 +0530 Subject: [PATCH] ForeignStructuredUpload: Stop using methods from CapsuleMultiselectWidget After I2146d8ce6505dae55750b4b12bd806b83796c1c5 CategoryMultiselectWidget inherits from TagMultiselectWidget instead of CapsuleMultiselectWidget. TagMultiselectWidget has a setValue method instead of setItemsFromData, and instead of getItemsData we need to use getItems and extract the data. Bug: T183299 Bug: T198362 Change-Id: Iff1f8a520a01e6771d6b496a87e4749b7c30a877 --- .../BookletLayout.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/src/mediawiki.ForeignStructuredUpload.BookletLayout/BookletLayout.js b/resources/src/mediawiki.ForeignStructuredUpload.BookletLayout/BookletLayout.js index 7d4ed537d7..d38adcd6cc 100644 --- a/resources/src/mediawiki.ForeignStructuredUpload.BookletLayout/BookletLayout.js +++ b/resources/src/mediawiki.ForeignStructuredUpload.BookletLayout/BookletLayout.js @@ -370,12 +370,15 @@ * @inheritdoc */ mw.ForeignStructuredUpload.BookletLayout.prototype.getText = function () { - var language = mw.config.get( 'wgContentLanguage' ); + var language = mw.config.get( 'wgContentLanguage' ), + categories = this.categoriesWidget.getItems().map( function ( item ) { + return item.data; + } ); this.upload.clearDescriptions(); this.upload.addDescription( language, this.descriptionWidget.getValue() ); this.upload.setDate( this.dateWidget.getValue() ); this.upload.clearCategories(); - this.upload.addCategories( this.categoriesWidget.getItemsData() ); + this.upload.addCategories( categories ); return this.upload.getText(); }; @@ -454,7 +457,7 @@ mw.ForeignStructuredUpload.BookletLayout.parent.prototype.clear.call( this ); this.ownWorkCheckbox.setSelected( false ); - this.categoriesWidget.setItemsFromData( [] ); + this.categoriesWidget.setValue( [] ); this.dateWidget.setValue( '' ).setValidityFlag( true ); }; -- 2.20.1