Page MenuHomePhabricator

Make error message for missing redirect badges more actionable
Closed, ResolvedPublic5 Estimated Story Points

Description

Problem:
The error message when the user tries to add a redirect without a badge, does not mention the cause of the error.

Steps to reproduce:

  • Edit Q9833 and add sitelink to redirect "enwiki:James Hamilton, Duke of Châtellerault"
  • Publish

Result:

  • error message A is shown

Error Message A:

Could not save due to an error.
1. The save has failed.
2. The link "enwiki:James Hamilton, Duke of Châtellerault" is already used by Item Q9833. You may remove it from Q9833 if it does not belong there or merge the Items if they are about the exact same topic.

Solution:
Show error message B instead in this case, to make the error message more actionable.

Error Message B:

Could not save due to an error.
1. The save has failed.
2. The link "enwiki:James Hamilton, Duke of Châtellerault" is already used by Item Q9833. You may remove it from Q9833 if it does not belong there or merge the Items if they are about the exact same topic. If the situation is more complex, please see: [https://www.wikidata.org/wiki/Help:Sitelinks#Linking_to_Wikimedia_site_pages Help:Sitelinks]

BDD:
If a redirect is not allowed as a sitelinks because of a missing redirect badge, then the error message is amended:

GIVEN an Item
AND a page on the client that is a redirect
AND the redirect target is already used in another Item
WHEN adding the page as a sitelink to the Item
AND not adding a redirect badge in the same edit
THEN the edit is rejected
AND the user is pointed to helpful information on how to resolve the problem (see error message B)

Acceptance criteria:

  • If a redirect is not allowed as a sitelinks because of a missing redirect badge, then error message B is shown (see BDD).
  • If there is no "intentional sitelink to redirect" badge (Q70894304) configured, still use the original error message A.

Links:

Original:

Event Timeline

Manuel updated the task description. (Show Details)
Manuel updated the task description. (Show Details)
Manuel updated the task description. (Show Details)
Manuel updated the task description. (Show Details)
Manuel updated the task description. (Show Details)

Note: We decided on Mattermost that, to keep the code relatively simple, the choice of error message should only depend on whether redirect badges are configured on the wiki at all, not on whether the particular sitelink edited by the user is a redirect or not. I’m not sure if the message text has already been updated to account for this.

Yes, I had already updated the AC and Copy based on our Mattermost discussion. Just let me know in case anything is unclear.

Plan of Action

  • The error is currently thrown in SiteLinkUniquenessValidator.php
  • We can inject configuration through the constructor and adjust the error message accordingly
  • The newer message for configured badges is to be added to en.json and qqq.json
  • Add a reference in the original message's qqq.json entry referring to the new message in order to imply translators that those are to be kept in sync (and vice versa)

Change 861841 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Delay work in EntityConstraintProvider

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

Change 861841 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Delay work in EntityConstraintProvider

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

The link "enwiki:James Hamilton, Duke of Châtellerault" is already used by Item Q9833. You may remove it from Q9833 if it does not belong there or merge the Items if they are about the exact same topic. If the situation is more complex, please see: https://www.wikidata.org/wiki/Help:Sitelinks#Linking_to_Wikimedia_site_pages

Are we linking this page with a bare URL or should there be some link text?

There is also another error message that can occur when the item ID of the other item isn’t known (which can happen due to a race condition in a cache, I think):

The link $1 is also used by another Item that is currently being saved.

Do we also want a version B of this message? (I suspect not.)

Change 862983 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Change sitelink conflict message if redirects supported

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

The link "enwiki:James Hamilton, Duke of Châtellerault" is already used by Item Q9833. You may remove it from Q9833 if it does not belong there or merge the Items if they are about the exact same topic. If the situation is more complex, please see: https://www.wikidata.org/wiki/Help:Sitelinks#Linking_to_Wikimedia_site_pages

Are we linking this page with a bare URL or should there be some link text?

Because of API users, I was thinking of a bare URL. How do we usually do this?

There is also another error message that can occur when the item ID of the other item isn’t known (which can happen due to a race condition in a cache, I think):

The link $1 is also used by another Item that is currently being saved.

Do we also want a version B of this message? (I suspect not.)

I agree!

I think we usually use normal wikitext link syntax:

"wikibase-anonymouseditwarning": "Warning: You are not logged in. Your [https://en.wikipedia.org/wiki/IP_address IP address] will be publicly visible...",
"wikibase-validator-no-such-media": "The file \"$1\" does not exist on [https://commons.wikimedia.org/ Wikimedia Commons].",
"wikibase-itembytitle-create": "You can also [$1 create an Item].",
"wikibase-itemdisambiguation-search": "You can [$1 search for the Item].",

Okay, perfect, thank you, Lucas! Let's do that then! :)

Change 862983 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Change sitelink conflict message if redirects supported

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

Working great! \o/