Lucas Werkmeister (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362234 )

Change subject: Include other items in Unique value violation message
......................................................................

Include other items in Unique value violation message

Without this, the message is useless for fixing the violation.

Bug: T169186
Change-Id: I05a0f179897558557e1a61bc61af2c43c9edd296
---
M i18n/en.json
M i18n/qqq.json
M includes/ConstraintCheck/Checker/UniqueValueChecker.php
3 files changed, 6 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/34/362234/1

diff --git a/i18n/en.json b/i18n/en.json
index 6155fe1..f8f8156 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -100,5 +100,5 @@
        "wbqc-violation-message-valueType-instance": "Values of $1 statements 
should be instances of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following 
classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of 
their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: 
$4}}",
        "wbqc-violation-message-valueType-subclass": "Values of $1 statements 
should be subclasses of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following 
classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of 
their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: 
$4}}",
        "wbqc-violation-message-target-required-claim": "$1 should have 
{{PLURAL:$3|0=a statement $2.|1=a statement $2 $5.|a statement for $2 with one 
of the following values:$4}}",
-       "wbqc-violation-message-unique-value": "This property's value must not 
be present on any other item."
+       "wbqc-violation-message-unique-value": "This property's value must not 
be present on any other item, but is also present on {{PLURAL:$1|1=$3.|2=$3 and 
$4.|the following items: $2}}"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 373ab46..a37f040 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -95,5 +95,5 @@
        "wbqc-violation-message-valueType-instance": "Message for a violation 
of the “Value type” constraint, when the value of a statement should have be an 
instance of a certain type but isn't. $1 is the property of the statement, $2 
is the value of the statement, $3 is the number of classes, $4 is an HTML list 
of all classes, and $5, $6 etc. are the individual 
classes.{{Related|wbqc-violation-message-valueType-subclass}}",
        "wbqc-violation-message-valueType-subclass": "Message for a violation 
of the “Value type” constraint, when the value of a statement should have be a 
subclass of a certain type but isn't. $1 is the property of the statement, $2 
is the value of the statement, $3 is the number of classes, $4 is an HTML list 
of all classes, and $5, $6 etc. are the individual 
classes.{{Related|wbqc-violation-message-valueType-instance}}",
        "wbqc-violation-message-target-required-claim": "Message for a 
violation of the “Target required claim” constraint, when the target entity of 
a statement is missing an expected statement. Parameters:\n* $1 is the subject 
entity of the missing statement, i. e. the target entity of the statement that 
has the constraint.\n* $2 is the property of the missing statement.\n* $3 is 
the number of values permitted for the missing statement (or 0, in which case 
the constraint only specifies that there should be a statement but not the 
values it should have).\n* $4 is an HTML list of all values permitted for the 
missing statement.\n* $5, $6 etc. are the individual values permitted for the 
missing statement.\n{{Related|wbqc-violation-message-item}}",
-       "wbqc-violation-message-unique-value": "Message for violation of the 
Unique Value constraint, when other items are found."
+       "wbqc-violation-message-unique-value": "Message for violation of the 
Unique Value constraint, when other items are found. Parameters:\n* $1 is the 
number of other items with the same value.\n* $2 is an HTML list of all other 
items found with the same value.\n* $3, $4 etc. are the individual other items 
with the same value."
 }
diff --git a/includes/ConstraintCheck/Checker/UniqueValueChecker.php 
b/includes/ConstraintCheck/Checker/UniqueValueChecker.php
index b8238a7..9d8fc53 100644
--- a/includes/ConstraintCheck/Checker/UniqueValueChecker.php
+++ b/includes/ConstraintCheck/Checker/UniqueValueChecker.php
@@ -63,8 +63,10 @@
                                $message = '';
                        } else {
                                $status = CheckResult::STATUS_VIOLATION;
-                               // TODO include the other entities in the 
message
-                               $message = wfMessage( 
'wbqc-violation-message-unique-value' )->escaped();
+                               $message = wfMessage( 
'wbqc-violation-message-unique-value' )
+                                                ->numParams( count( 
$otherEntities ) )
+                                                ->rawParams( 
$this->constraintParameterRenderer->formatItemIdList( $otherEntities, 
ConstraintParameterRenderer::ROLE_SUBJECT ) )
+                                                ->escaped();
                        }
                } else {
                        $status = CheckResult::STATUS_TODO;

-- 
To view, visit https://gerrit.wikimedia.org/r/362234
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05a0f179897558557e1a61bc61af2c43c9edd296
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to