jenkins-bot has submitted this change and it was merged. Change subject: Don't allow bad lang codes in SpecialNewEntity ......................................................................
Don't allow bad lang codes in SpecialNewEntity Bug: T138725 Change-Id: I46f55dc1f60920bc37369645447f74d13e18701d --- M repo/i18n/en.json M repo/i18n/qqq.json M repo/includes/Specials/SpecialNewEntity.php 3 files changed, 9 insertions(+), 1 deletion(-) Approvals: Thiemo Mättig (WMDE): Looks good to me, approved jenkins-bot: Verified diff --git a/repo/i18n/en.json b/repo/i18n/en.json index 2e20407..3df691e 100644 --- a/repo/i18n/en.json +++ b/repo/i18n/en.json @@ -168,6 +168,7 @@ "wikibase-newitem-page": "Name of the first linked page", "wikibase-newitem-no-external-page": "The specified page could not be found on the corresponding site.", "wikibase-newitem-not-recognized-siteid": "The provided site identifier was not recognized.", + "wikibase-newitem-not-recognized-language": "The supplied language code was not recognized.", "wikibase-newentity-language": "Language:", "wikibase-newentity-label": "Label:", "wikibase-newentity-description": "Description:", diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json index 2d4a7e0..e3de358 100644 --- a/repo/i18n/qqq.json +++ b/repo/i18n/qqq.json @@ -199,6 +199,7 @@ "wikibase-newitem-page": "Label for the page-textfield holding the page name of the first linked page to add to the new item", "wikibase-newitem-no-external-page": "Error message shown when a user tries to add a page that does not exist on the website choosen.", "wikibase-newitem-not-recognized-siteid": "Error message shown when a user tries to add a link to a site with an unknown identifier.\n\nSee also:\n* {{msg-mw|Wikibase-api-not-recognized-siteid}}", + "wikibase-newitem-not-recognized-language": "Error message shown when a user tries to create an item with an unknown language code.\n\nSee also:\n* {{msg-mw|Wikibase-api-not-recognized-language}}", "wikibase-newentity-language": "Label for the \"lang\" dropdown menu holding the language in which the label, description and aliases of the new item should be typed.\n{{Identical|Language}}", "wikibase-newentity-label": "Label for the \"label\" textfield holding the label of the new item.\n{{Identical|Label}}", "wikibase-newentity-description": "Label for the \"description\" textfield holding the description of the new item.\n{{Identical|Description}}", diff --git a/repo/includes/Specials/SpecialNewEntity.php b/repo/includes/Specials/SpecialNewEntity.php index 2803dbe..ab8a2d7 100644 --- a/repo/includes/Specials/SpecialNewEntity.php +++ b/repo/includes/Specials/SpecialNewEntity.php @@ -238,13 +238,19 @@ } $fingerprint = $entity->getFingerprint(); + $status = Status::newGood(); + $languageCode = $this->contentLanguageCode; + if ( !in_array( $languageCode, $this->languageCodes ) ) { + $status->error( 'wikibase-newitem-not-recognized-language' ); + return $status; + } $fingerprint->setLabel( $languageCode, $this->label ); $fingerprint->setDescription( $languageCode, $this->description ); $fingerprint->setAliasGroup( $languageCode, $this->aliases ); - return Status::newGood(); + return $status; } /** -- To view, visit https://gerrit.wikimedia.org/r/296198 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I46f55dc1f60920bc37369645447f74d13e18701d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Adrian Heine <adrian.l...@wikimedia.de> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: Lydia Pintscher <lydia.pintsc...@wikimedia.de> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits