Page MenuHomePhabricator

Allow creating items with badges using Special:NewItem
Closed, ResolvedPublic

Description

Reproduce:
https://www.wikidata.org/wiki/Special:NewItem?site=zhwiki&page=%E6%9C%89%E5%90%91%E5%9B%BE

Expected:
An item can be created with the redirect as a sitelink and a default redirect badge is added automatically

Actual:
Fail to create the item

Event Timeline

Change 979156 had a related patch set uploaded (by Oudedutchman; author: Oudedutchman):

[mediawiki/extensions/Wikibase@master] Allow creating items with badges using Special:NewItem

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

@Lucas_Werkmeister_WMDE thank you for your comments. I am new here and therefore do not know many things. I have tried to implement checkboxes similar to those in Special:SetSitelink. Can you tell me if I am working in the right direction?

An item can be created with the redirect as a sitelink and a default redirect badge is added automatically

I don’t think adding it automatically would be a good idea; this should be a conscious user choice. (Also, Wikibase only knows a set of badges – “sitelink to redirect” and “intentional sitelink to redirect” on Wikidata – and it’s not clear which of them should be added automatically.) But we can try adding a badge-selector, similar to Special:SetSitelink, as @Oudedutchman tried out on Gerrit; I quickly discussed this with @Arian_Bozorg and we can probably go ahead with this (but it would be great to have a screenshot to see how it looks before merging).

Oudedutchman renamed this task from Allow creating items for redirects using Special:NewItem to Allow creating items with badges using Special:NewItem.Dec 1 2023, 4:09 PM

@Lucas_Werkmeister_WMDE I believe that in cases of redirect, the 'intentional sitelink to redirect' badge should be added automatically. We can assume that if the user opens a redirect page and decides to attach it to Wikidata, they know what they’re doing. However, as I understand it, this is more related to T324419, although I'm still unclear about what the 'add links' gadget is. But let's broaden this task to the general issue of adding badges in Special:NewItem. The automatic addition of the 'intentional sitelink to redirect' badge to redirects could be managed within the Wikibase client. What are your thoughts?

We can assume that if the user opens a redirect page and decides to attach it to Wikidata, they know what they’re doing.

In this task, I don’t think we can safely assume that the user opened a redirect page in the first place. They may have opened the page before it was turned into a redirect, they may have arrived at Special:NewItem following a link other than the one at the bottom of the language link list (e.g. a link in the wikitext of a page, or a link in a Toolforge tool). While in T324419, I think it makes sense to add the badge automatically (if possible), it’s too risky in this task’s patch. With the broadened scope (which I agree with), it would also be inconsistent to automatically add the redirect badge but not the other ones.

Screenshots of the current state of the Gerrit change:

Special:NewItem, with site and page in the URL:

image.png (1×1 px, 187 KB)

For comparison, Special:SetSitelink (not changed):

image.png (1×1 px, 162 KB)

Also, note that this only takes effect when a site and page have been specified in the URL, otherwise there’s no change:

image.png (926×1 px, 139 KB)

@Lucas_Werkmeister_WMDE wrote that he is pretty sure the error in https://integration.wikimedia.org/ci/job/mediawiki-quibble-apitests-vendor-php74-docker/49376/console is unrelated and can be ignored. Then what is the workflow now with this issue?

The main thing we need is confirmation from @Arian_Bozorg that the change is okay to go ahead with, based on the screenshots I posted above. I also wanted to try to add a new test for this feature, but then I ran into T352695 and have been busy with that and other stuff this week – that’s why I didn’t reply for a few days, sorry.

If you want, you can try to extend SpecialNewItemTest yourself (e.g. add a check for the badge input(s) to testSiteAndPageInputFieldsWithPredefinedValuesPresent_WhenRenderedWithGetParametersPassed(), though I don’t know yet what the right assertion method is); otherwise I’ll see if I can get around to it next week.

This looks ok to me, it follows the same patterns as we have on Special:SetSitelink and it is only triggered with the URL.

But who ends up on that page and how do we get to that page?

@Arian_Bozorg If an anonymous user (or any other user without the AddLinks gadget) clicks on Links hinzufügen on a page that is not already connected to a Wikidata item (for example, a redirect like https://de.wikipedia.org/w/index.php?title=Landeshauptstadt_Dresden&redirect=no), they would be directed to https://www.wikidata.org/wiki/Special:NewItem?site=dewiki&page=Landeshauptstadt+Dresden. There, they could then set the correct redirect badge, or, if it's not a redirect, another necessary badge. For users with the AddLinks gadget, there is a similar task (T324419) which I plan to tackle after this one.

Thanks so much!

Tagging @Sarai-WMDE here to have a look. I am little concerned that this adds complexity for unfamilar users, but should be ok as it's only on the redirect and also helps walk them through what is required to create the item.

it's only on the redirect and also helps walk them through what is required to create the item.

It’s not only when connecting redirects. The badge selector always appears when Special:NewItem is reached with site and page specified in the URL, regardless of whether the page is a redirect. So it always appears when Special:NewItem is reached by clicking on the Add links link on a Wikibase Client site, but never when Special:NewItem is reached by clicking on the Create a new Item link in the Wikidata sidebar.

(Thanks for the heads-up! Unfortunately, I'll only be able to take a proper look at this from 08/01/24. Will leave any relevant comments from my side here asap)

If everything is good, may someone approve and merge? :)

If everything is good, may someone approve and merge? :)

No, Sarai still needs to take a look.

I believe overall the changes look good, and agree with keeping badge selection as a conscious user choice.
(Would love to explore ways to replace that long list of checkboxes by a less bulky component, but that's for a different task).
Thanks for the contribution, and apologies for the delayed review!

Change 979156 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Allow creating items with badges on Special:NewItem

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

Oudedutchman claimed this task.