jenkins-bot has submitted this change and it was merged. Change subject: Make JS repoApi aware of editEntity's "new" parameter ......................................................................
Make JS repoApi aware of editEntity's "new" parameter Bug: 49526 Change-Id: If4a37d5de31c930d9227bdacbddf2fc6b9efa7ae --- M lib/resources/wikibase.RepoApi/wikibase.RepoApi.js M lib/tests/qunit/wikibase.RepoApi/wikibase.RepoApi.tests.js 2 files changed, 7 insertions(+), 4 deletions(-) Approvals: Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js b/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js index ae34f67..461c862 100644 --- a/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js +++ b/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js @@ -36,15 +36,18 @@ _api: new mw.Api(), /** - * Creates a new entity with given data. + * Creates a new entity with the given type and data. * + * @param {String} type The type of the entity that should be created. + * Currently supported types: item|property|query * @param {Object} [data] The entity data (may be omitted to create an empty entity) * @return {jQuery.Promise} */ - createEntity: function( data ) { + createEntity: function( type, data ) { var params = { action: 'wbeditentity', - data: $.toJSON( data ) + data: $.toJSON( data ), + 'new': type }; return this.post( params ); }, diff --git a/lib/tests/qunit/wikibase.RepoApi/wikibase.RepoApi.tests.js b/lib/tests/qunit/wikibase.RepoApi/wikibase.RepoApi.tests.js index 3dfed5a..f5b9c59 100644 --- a/lib/tests/qunit/wikibase.RepoApi/wikibase.RepoApi.tests.js +++ b/lib/tests/qunit/wikibase.RepoApi/wikibase.RepoApi.tests.js @@ -76,7 +76,7 @@ var createItem = function( data ) { data = data || {}; - api.createEntity( data ).done( function( response ) { + api.createEntity( 'item', data ).done( function( response ) { QUnit.assert.equal( response.success, 1, -- To view, visit https://gerrit.wikimedia.org/r/68639 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If4a37d5de31c930d9227bdacbddf2fc6b9efa7ae Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Daniel Werner <daniel.wer...@wikimedia.de> Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits