Page MenuHomePhabricator

Page curation toolbar and Special:NewPagesFeed should show blue links when there is a global user page
Open, LowestPublicBUG REPORT

Description

When the creator or the reviewer of a page has a global user page but no local user page, the link to the user page should appear blue instead of red in the page curation toolbar and Special:NewPagesFeed.


See also: (similar issue, but independent fix needed) T72123: VisualEditor redlink detection should obey Title::isAlwaysKnown (so that links to Special pages, EducationProgram pages and GlobalUserPages render correctly)

Event Timeline

Aklapper triaged this task as Lowest priority.May 1 2016, 9:59 AM

PageCuration should be using Title::isKnown() instead of Title::exists().

Confirmed that these are usually bluelinks instead of redlinks outside of PageTriage (I just tested in a sandbox). Legoktm's comment above looks like a good hint of what to look for in the code.

Title::exists does not show up in a search of the codebase.

In the PageTriage code, the front end uses custom code to make the title links, based on what is fed to it by the API by the creator_user_page_exist parameter.

JavaScript

this.model.buildLinkTag(
	this.model.get( 'creator_user_page_url' ),
	this.model.get( 'user_name' ),
	this.model.get( 'creator_user_page_exist' )
),
buildLinkTag: function ( url, text, exists ) {
	let style = '';
	if ( !exists ) {
		url = this.buildRedLink( url, exists );
		style = 'new';
	}
	return $( '<a>' )
		.attr( {
			href: url,
			class: style
		} )
		.text( text );
},

buildRedLink: function ( url, exists ) {
	url = new mw.Uri( url );
	if ( !exists ) {
		url.query.action = 'edit';
		url.query.redlink = 1;
	}
	return url.toString();
},

PHP

$metaData[$page][ApiResult::META_BC_BOOLS] = [
	'creator_user_page_exist', 'creator_user_talk_page_exist',
	'reviewer_user_page_exist', 'reviewer_user_talk_page_exist',
];

API sandbox example of pagetriagelist API:

image.png (597×950 px, 66 KB)

I'm not sure where creator_user_page_exist is coming from. Where the variable is assigned is not showing up in a search of the codebase for that keyword.

I was hoping this was an easy fix, but this looks a bit elaborate. So I'll stop here for now.

Title::exists does not show up in a search of the codebase.

In the PageTriage code, the front end uses custom code to make the title links, based on what is fed to it by the API by the creator_user_page_exist parameter.

JavaScript

this.model.buildLinkTag(
	this.model.get( 'creator_user_page_url' ),
	this.model.get( 'user_name' ),
	this.model.get( 'creator_user_page_exist' )
),
buildLinkTag: function ( url, text, exists ) {
	let style = '';
	if ( !exists ) {
		url = this.buildRedLink( url, exists );
		style = 'new';
	}
	return $( '<a>' )
		.attr( {
			href: url,
			class: style
		} )
		.text( text );
},

buildRedLink: function ( url, exists ) {
	url = new mw.Uri( url );
	if ( !exists ) {
		url.query.action = 'edit';
		url.query.redlink = 1;
	}
	return url.toString();
},

PHP

$metaData[$page][ApiResult::META_BC_BOOLS] = [
	'creator_user_page_exist', 'creator_user_talk_page_exist',
	'reviewer_user_page_exist', 'reviewer_user_talk_page_exist',
];

API sandbox example of pagetriagelist API:

image.png (597×950 px, 66 KB)

I'm not sure where creator_user_page_exist is coming from. Where the variable is assigned is not showing up in a search of the codebase for that keyword.

I was hoping this was an easy fix, but this looks a bit elaborate. So I'll stop here for now.

It's coming from createUserInfo which uses Title::makeTitle():

private function createUserInfo( $userName, $userPageStatus, $prefix ) {
		$userPage = Title::makeTitle( NS_USER, $userName );
		$userTalkPage = Title::makeTitle( NS_USER_TALK, $userName );
		$userContribsPage = SpecialPage::getTitleFor( 'Contributions', $userName );

		return [
			$prefix . '_user_page' => $userPage->getPrefixedText(),
			$prefix . '_user_page_url' => $userPage->getFullURL(),
			$prefix . '_user_page_exist' => isset( $userPageStatus[$userPage->getPrefixedDBkey()] ),
			$prefix . '_user_talk_page' => $userTalkPage->getPrefixedText(),
			$prefix . '_user_talk_page_url' => $userTalkPage->getFullURL(),
			$prefix . '_user_talk_page_exist' => isset( $userPageStatus[$userTalkPage->getPrefixedDBkey()] ),
			$prefix . '_contribution_page' => $userContribsPage->getPrefixedText(),
			$prefix . '_contribution_page_url' => $userContribsPage->getFullURL(),
		];
	}

I think the relevant code we need to update is in PageTriageUtil::pageStatusForUser. I believe this code could be simplified to get the reviewer and author for each entry, call Title::isKnown(). I am not sure there is a need for the custom cache and DB queries being made in that code.

Change 892383 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/PageTriage@master] [WIP] PageTriageUtil: Simplifiy getPageStatusForUsers

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

Change 892383 abandoned by Kosta Harlan:

[mediawiki/extensions/PageTriage@master] [WIP] PageTriageUtil: Simplify getPageStatusForUsers

Reason:

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

HouseBlaster changed the subtype of this task from "Task" to "Bug Report".Dec 14 2023, 11:28 PM

perhaps worth noting that it shows this screen when clicking on the redlink:

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

Novem_Linguae renamed this task from Page curation toolbar should show blue links when there is a global user page to Page curation toolbar and Special:NewPagesFeed should show blue links when there is a global user page.Sep 1 2024, 12:12 PM