Page MenuHomePhabricator

Allow connecting redirects using sitelink widget
Open, Needs TriagePublic

Description

Reproduce:

Expected:
A sitelink to redirect (with redirect badge) is added to some item, or a new item is created with the provided redirect as sitelink (with redirect badge)

Actual:
Failed to add the sitelink, or the item for the redirect target is incorrectly merged

Note:
We need to define a default redirect badge

Event Timeline

I think the default badge should be intentional sitelink to redirect, as 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, if the page is turned into a redirect between the time it’s loaded and the time it’s (attempted to be) connected to Wikidata, the badge should not be added, since the user is likely not aware of the situation. (Or, even better, the connection to Wikidata should fail even if the redirect target is not connected to Wikidata and thus adding the sitelink without a badge could succeed. A page being turned into a redirect is a point where the user needs to reconsider if adding the sitelink is still appropriate.)

Manuel added a subscriber: Ifeatu_Nnaobi_WMDE.

Hi @Oudedutchman, thank you for adding me. I don't know of any updates on this from our side, but I am now mainly working on analytics so I can't be sure. Are there reasons that make this particularly urgent or important for you?

In case someone is testing this at some point, better use a different page then the example given in the original description (as there are now already sitelinks attached).

(CC: @Ifeatu_Nnaobi_WMDE)

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

[mediawiki/extensions/Wikibase@master] Allow creating a new item for redirects

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

@Lucas_Werkmeister_WMDE I want to start contributing to Wikibase, and for this purpose, I decided to begin with this issue. I've made an initial commit in which I've added the capability to create a new item with badges. Could you review it, please?

@Tacsipacsi as far as I understand we first need to allow creation of item with sitelinks to redirect, because client basically points to the Special:NewItem

It links to Special:NewItem, but a click handler brings up a dialog window (rather than navigating away) if there are no interlanguage links: that is the “add links” gadget. Being a JavaScript tool, it uses the MediaWiki action API, not a special page.

For me it is actually navigating to the Special:NewItem if there are no interlanguage links. And I could not find any “add links” gadget.

For me it is actually navigating to the Special:NewItem if there are no interlanguage links. And I could not find any “add links” gadget.

Tested on https://test.wikipedia.org/wiki/Test%E0%BA%81%E0%BB%8D%E0%BB%89, clicking on the Add links link did open up the gadget for me. It looks like this:

Screenshot 2023-12-01 at 21-55-43 Testກໍ້ - Test Wikipedia.png (283×533 px, 17 KB)

Do you know where there is a code for this add links” gadget? I only see in mediawiki/extensions/Wikibase repo RepoItemLinkGenerator.php where

	private function getNewItemUrl( Title $title ) {
		$params = [
			'site' => $this->siteGlobalId,
			'page' => $title->getPrefixedText(),
		];

		$url = $this->repoLinker->getPageUrl( 'Special:NewItem' );
		$url = $this->repoLinker->addQueryParams( $url, $params );

		return $url;
	}

The main code for it is in client/resources/jquery.wikibase/jquery.wikibase.linkitem.js, with some other files listed in the jquery.wikibase.linkitem ResourceLoader module in extension-client.json.

Did I understand correctly that there are two scenarios that need to be addressed? The first scenario occurs when a user utilizes the 'add links' widget in Wiki A on a redirect page that is not linked to a Wikidata item. The second scenario happens when a user attempts to use the 'add links' widget in Wiki A to link a redirect from another Wiki B. In this second scenario, the page in Wiki A may also be a redirect.

The second scenario happens when a user attempts to use the 'add links' widget in Wiki A to link a redirect from another Wiki B.

Note in this case it is possible that the user intended to connect the redirect target in Wiki B (does not know the Wiki B page is redirect), so we should not add a redirect badge directly (instead we may first let user confirm which page they should link).
Anyway the first scenario may be more important.