Page MenuHomePhabricator

MUL - Do not allow adding term descriptions with the language code mul on Wikidata
Closed, ResolvedPublic5 Estimated Story Points

Description

Problem:
There is currently no use-case for descriptions in language code mul. Therefore, users should not be able use add mul for descriptions.

Solution:
Disallow mul for descriptions on the API level (and therefore also via UI).

Notes:

  • This could be achieved using a soft (see T289474) constraint (hardcoded, similar to T212869).
  • This can’t be achieved using an AbuseFilter, as an AbuseFilter doesn’t have access to a sufficiently structured diff to reliably detect mul descriptions.

Copy of error message:

The language code “mul” (multiple languages) can only be used for labels and aliases, not for descriptions.

BDD:

If an editor tries to save a mul description then an error message is shown.

GIVEN an Item
WHEN an editor tries to enter a description in language code mul
THEN the edit is not accepted
AND and the error message (see copy above) is shown

Acceptance criteria:

  • If an editor tries to save a mul description then an error is shown.
  • The error message is translatable (and uses the correct language name for "multiple languages" as a parameter of the message).
  • an error is shown via api

*Notes*

  • frontend error display is basic. will be updated in a future task

Community communication:
No separate communication needed.

Original:
https://www.wikidata.org/wiki/Help_talk:Label#Drafting_of_guidelines_for_new_language_code_mul

Related Objects

Event Timeline

Manuel renamed this task from Do not allow adding term descriptions with the language code `mul` on Wikidata to Do not allow adding term descriptions with the language code mul on Wikidata.Sep 6 2022, 1:18 PM
Manuel updated the task description. (Show Details)
karapayneWMDE renamed this task from Do not allow adding term descriptions with the language code mul on Wikidata to MUL - Do not allow adding term descriptions with the language code mul on Wikidata.Sep 13 2022, 9:59 AM
  • This could be achieved using a soft (see T289474) constraint (hardcoded, similar to T212869).

At the time, T212869 was implemented in TermValidatorFactory::getFingerprintValidator(), but the code seems to have moved around a bit since then; the FingerprintUniquenessValidator is now calld in ChangeOpFingerprintResult::validate(), while the LabelDescriptionNotEqualValidator is used in ChangeOpLabel::validate() and ChangeOpDescription::validate().

The new validator for “no mul description” can probably go into ChangeOpDescription.

We also need to check whether, as in T212869, we need to implement this check separately for Special:NewProperty (and Special:NewItem?) as well, or if the special pages are covered by the ChangeOp validation. (This might have been fixed for Special:NewProperty with validate term length in Special:NewProperty for T308659.)

Other places to check, just to make sure that the validator is being called:

  • wbeditentity
  • wbsetdescription
  • Special:SetDescription
  • Special:SetLabelDescriptionAliases
karapayneWMDE set the point value for this task to 5.
karapayneWMDE moved this task from Unified DOT Backlog to Sprint-∞ on the Wikidata Dev Team board.

Task Breakdown Notes:

Plan of Action:

  • A new error message should be added (copy specified in the task's description)
  • \Wikibase\Repo\Validators\TermValidatorFactory::getDescriptionValidator(); should add a validator for this condition
  • We should make sure the right condition gets called by the following endpoints:
    • wbeditentity
    • wbsetdescription
    • Special:SetDescription
    • Special:SetLabelDescriptionAliases
    • Special:NewItem
    • Special:NewProperty
karapayneWMDE moved this task from Doing to Todo/Backlog on the Wikidata Dev Team (Sprint-∞) board.
karapayneWMDE added a subscriber: hoo.

Change 871127 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/Wikibase@master] Do not allow adding mul descriptions

https://gerrit.wikimedia.org/r/871127

Change 871129 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/Wikibase@master] SpecialNewItem: Use term language validators

https://gerrit.wikimedia.org/r/871129

Change 871130 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/Wikibase@master] SpecialNewProperty: Use term language validators

https://gerrit.wikimedia.org/r/871130

[…]

  • We should make sure the right condition gets called by the following endpoints:
    • wbeditentity
    • wbsetdescription
    • Special:SetDescription
    • Special:SetLabelDescriptionAliases
    • Special:NewItem
    • Special:NewProperty

I successfully tested all of these (with the full patch chain applied).

Change 871127 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Do not allow adding mul descriptions

https://gerrit.wikimedia.org/r/871127

Change 871129 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] SpecialNewItem: Use term language validators

https://gerrit.wikimedia.org/r/871129

Change 871130 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] SpecialNewProperty: Use term language validators

https://gerrit.wikimedia.org/r/871130

Just tagging @Manuel here, as he is best to verify this one.

Awesome, thank you! \o/