Skip to content

Commit

Permalink
Link to constraint statement instead of statement group
Browse files Browse the repository at this point in the history
Now that each individual statement has an HTML ID, we can link to the
correct constraint statement, not just to the statement group for all
constraint statements.

Bug: T169224
Change-Id: Id801971f05e41bd29f8d3f104e63eb006fbefdae
  • Loading branch information
lucaswerkmeister committed Jul 16, 2018
1 parent 42a0250 commit 978863a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Api/CheckResultsRenderer.php
Expand Up @@ -82,8 +82,7 @@ public function checkResultToArray( CheckResult $checkResult ) {

$title = $this->entityTitleLookup->getTitleForId( $constraintPropertyId );
$typeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) );
// TODO link to the statement when possible (T169224)
$link = $title->getFullURL() . '#' . $this->config->get( 'WBQualityConstraintsPropertyConstraintId' );
$link = $title->getFullURL() . '#' . $constraintId;

$constraint = [
'id' => $constraintId,
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Api/CheckResultsRendererTest.php
Expand Up @@ -175,7 +175,7 @@ public function testCheckResultToArray_Constraint() {
$this->assertSame( $checkResult->getConstraintId(), $constraint['id'] );
$this->assertSame( 'Q1', $constraint['type'] );
$this->assertSame( 'Q1', $constraint['typeLabel'] );
$this->assertSame( 'http://wiki.test/P1#P2302', $constraint['link'] );
$this->assertSame( 'http://wiki.test/P1#P1$31d77e02-e1bd-423e-811e-7f6dd5da0b90', $constraint['link'] );
$this->assertSame( 'http://wiki.test/Talk:P1', $constraint['discussLink'] );
}

Expand Down

0 comments on commit 978863a

Please sign in to comment.