Skip to content

Commit

Permalink
Ignore capitalization for label and description conflicts.
Browse files Browse the repository at this point in the history
DEPLOY: This is technically a breaking change, and may even affect some
existing pairs of items (which should probably be merged). Problems
should be rare, but the issue should still be announced.

Bug: T73785
Change-Id: I4a1a984648cd63b7bec220bfb4b739fd4b4fb579
  • Loading branch information
Benestar authored and Daniel Kinzler committed Apr 14, 2015
1 parent 5297979 commit 30628da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/includes/store/sql/TermSqlIndex.php
Expand Up @@ -828,6 +828,7 @@ public function getLabelConflicts( $entityType, array $labels ) {
$entityType,
array(
'LIMIT' => $this->maxConflicts,
'caseSensitive' => false
)
);

Expand Down Expand Up @@ -886,8 +887,8 @@ public function getLabelWithDescriptionConflicts(

$matchConditions = array(
'L.term_language' => $lang,
'L.term_text' => $label,
'D.term_text' => $description,
'L.term_search_key' => $this->getSearchKey( $label, $lang ),
'D.term_search_key' => $this->getSearchKey( $description, $lang )
);

$termConditions[] = $dbr->makeList( $matchConditions, LIST_AND );
Expand Down
20 changes: 20 additions & 0 deletions lib/tests/phpunit/store/TermIndexTest.php
Expand Up @@ -389,6 +389,12 @@ public function labelConflictProvider() {
array( 'de' => 'Foo' ),
array( 'P6' ),
),
'by label, different case' => array(
$entities,
Property::ENTITY_TYPE,
array( 'de' => 'fOO' ),
array( 'P6' ),
),
'by label mismatch' => array(
$entities,
Item::ENTITY_TYPE,
Expand Down Expand Up @@ -446,6 +452,20 @@ public function labelWithDescriptionConflictProvider() {
array( 'de' => 'Bar' ),
array( 'Q1' ),
),
'by label and description, different label capitalization' => array(
$entities,
Item::ENTITY_TYPE,
array( 'de' => 'fOO' ),
array( 'de' => 'Bar' ),
array( 'Q1' ),
),
'by label and description, different description capitalization' => array(
$entities,
Item::ENTITY_TYPE,
array( 'de' => 'Foo' ),
array( 'de' => 'bAR' ),
array( 'Q1' ),
),
'two languages for label and description' => array(
$entities,
Item::ENTITY_TYPE,
Expand Down

0 comments on commit 30628da

Please sign in to comment.