jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/373083 )
Change subject: Remove support for linking to property talk pages
......................................................................
Remove support for linking to property talk pages
Since there are no more constraints imported from templates, all
constraint IDs should be valid statement GUIDs, and we can remove the
fallback of linking to the property talk page.
This requires some minor changes to the API test, which now needs to
supply a parseable statement GUID as constraint ID, along with a
statement GUID parser that can parse property IDs as the first part.
Bug: T171291
Change-Id: I7524c1e2166f54eb15f430dfb2ee853173e40ccf
---
M api/CheckConstraints.php
M tests/phpunit/Api/CheckConstraintsTest.php
2 files changed, 8 insertions(+), 19 deletions(-)
Approvals:
Jonas Kress (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git a/api/CheckConstraints.php b/api/CheckConstraints.php
index 0155a21..e345017 100644
--- a/api/CheckConstraints.php
+++ b/api/CheckConstraints.php
@@ -342,20 +342,10 @@
$typeItemId =
$checkResult->getConstraint()->getConstraintTypeItemId();
$title = $this->entityTitleLookup->getTitleForId(
$checkResult->getPropertyId() );
- try {
- $statementGuid =
$this->statementGuidParser->parse( $constraintId );
- // constraint statement
- $typeLabel =
$this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) );
- // TODO link to the statement when possible
(T169224)
- $link = $title->getFullUrl() . '#' .
$this->config->get( 'WBQualityConstraintsPropertyConstraintId' );
- } catch ( StatementGuidParsingException $e ) {
- // constraint template on talk page
- $typeLabel = htmlspecialchars( $typeItemId );
- if ( !$title->canHaveTalkPage() ) {
- throw new MWException( 'Properties
namespace must define a talk namespace' );
- }
- $link =
$title->getTalkPageIfDefined()->getFullUrl();
- }
+ $statementGuid = $this->statementGuidParser->parse(
$constraintId );
+ $typeLabel =
$this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) );
+ // TODO link to the statement when possible (T169224)
+ $link = $title->getFullUrl() . '#' .
$this->config->get( 'WBQualityConstraintsPropertyConstraintId' );
$result = [
'status' => $checkResult->getStatus(),
diff --git a/tests/phpunit/Api/CheckConstraintsTest.php
b/tests/phpunit/Api/CheckConstraintsTest.php
index ac8b104..8a97293 100644
--- a/tests/phpunit/Api/CheckConstraintsTest.php
+++ b/tests/phpunit/Api/CheckConstraintsTest.php
@@ -13,7 +13,6 @@
use Wikibase\DataModel\Entity\ItemIdParser;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup;
-use Wikibase\DataModel\Services\Statement\StatementGuidParser;
use Wikibase\DataModel\Services\Statement\StatementGuidValidator;
use Wikibase\DataModel\Snak\PropertyValueSnak;
use Wikibase\DataModel\Statement\Statement;
@@ -135,7 +134,7 @@
'',
$entityIdParser,
new StatementGuidValidator( $entityIdParser ),
- new StatementGuidParser( $entityIdParser ),
+ $repo->getStatementGuidParser(),
$constraintChecker,
$constraintParameterRenderer,
$repo->getApiHelperFactory(
RequestContext::getMain() ),
@@ -239,11 +238,11 @@
}
private function givenPropertyHasViolation( PropertyId $propertyId ) {
- self::$checkerMap['violationConstraint'] = new FakeChecker(
CheckResult::STATUS_VIOLATION );
+ self::$checkerMap['Q1234'] = new FakeChecker(
CheckResult::STATUS_VIOLATION );
self::$constraintLookupContents[] = new Constraint(
- 'some guid',
+ 'P1234$6a4d1930-922b-4c2e-b6e1-9a06bf04c2f8',
$propertyId,
- 'violationConstraint',
+ 'Q1234',
[]
);
}
--
To view, visit https://gerrit.wikimedia.org/r/373083
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7524c1e2166f54eb15f430dfb2ee853173e40ccf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits