jenkins-bot has submitted this change and it was merged. Change subject: Report duplicate list label name error ......................................................................
Report duplicate list label name error When updating the label of an existing list with this query api.php?action=editlist&id=7&label=newlabel It is possible that the user has another list with the same label. This patch will show an error 'duplicatelabel' Without this patch, API currently returns an internal SQL error Change-Id: Ia5e056b3c16663afc0790d50eaafddd34b142f55 --- M includes/api/ApiEditList.php 1 file changed, 5 insertions(+), 1 deletion(-) Approvals: Robmoen: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/api/ApiEditList.php b/includes/api/ApiEditList.php index 0504f96..86f912e 100644 --- a/includes/api/ApiEditList.php +++ b/includes/api/ApiEditList.php @@ -290,7 +290,11 @@ } if ( $update ) { // ACTION: update list record - $dbw->update( 'gather_list', $update, array( 'gl_id' => $row->gl_id ), __METHOD__ ); + $dbw->update( 'gather_list', $update, array( 'gl_id' => $row->gl_id ), __METHOD__, 'IGNORE' ); + if ( $dbw->affectedRows() === 0 ) { + // update failed due to the duplicate label restriction. Report + $this->dieUsage( 'A list with this label already exists', 'duplicatelabel' ); + } $this->getResult()->addValue( null, $this->getModuleName(), array( 'status' => 'updated', ) ); -- To view, visit https://gerrit.wikimedia.org/r/196485 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia5e056b3c16663afc0790d50eaafddd34b142f55 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Gather Gerrit-Branch: master Gerrit-Owner: Yurik <yu...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: Robmoen <rm...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits