From: Prateek Saxena Date: Thu, 28 Jun 2018 07:13:29 +0000 (+0530) Subject: ForeignStructuredUpload: Stop using methods from CapsuleMultiselectWidget X-Git-Tag: 1.34.0-rc.0~4923^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=d9b9bf77fc4a2d118f090bcfa89b656ae8b4f3d6;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ); };