Page MenuHomePhabricator

Special:NewPages - add <span> for "originally created as..."
Closed, ResolvedPublic

Description

This is more a feature request, than a bug.

When listing new pages with Special:NewPages and you moved a page, there will be written "originally created as <pagename>".
Unfortunately, this is plain text and no html-element. So there is no change to format this text with css. Or - in my case - hide it.

Is there a chance, to enclose this message with a <span>?

Using MW 1.27.1

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 20 2016, 1:46 PM

Steps to reproduce:

  • Create a page Test
  • Move page to Template:Test

Then you'll see

originally created as "Test"

after the last <span> when calling Special:NewPages

Reedy added a subscriber: Reedy.

rc-old-title is the message used

		# Display the old title if the namespace/title has been changed
		$oldTitleText = '';
		$oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title );

		if ( !$title->equals( $oldTitle ) ) {
			$oldTitleText = $oldTitle->getPrefixedText();
			$oldTitleText = $this->msg( 'rc-old-title' )->params( $oldTitleText )->escaped();
		}

		return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} "
			. "{$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";

https://github.com/wikimedia/mediawiki/blob/master/includes/specials/SpecialNewpages.php#L373-L383

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptSep 20 2016, 8:19 PM

So changing

$oldTitleText = $this->msg( 'rc-old-title' )->params( $oldTitleText )->escaped();

to

$oldTitleText = Html::rawElement( 'span', [ 'class' => 'mw-newpages-oldtitle' ],
$this->msg( 'rc-old-title' )->rawParams( $oldTitleText )->escaped() );

would be a valid solution?

Yes, that looks right to me.

Hello,
I am new to WikiMedia and have picked this problem in order to learn how to create and submit patches here. Any suggestions, and/or help you could offer me is welcome. :)

Sidhant-gupta-004 removed Sidhant-gupta-004 as the assignee of this task.Oct 2 2016, 1:36 PM

Change 313762 had a related patch set uploaded (by Sidhant-gupta-004):
Special:NewPages - add <span> for "originally created as..."

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

Change 313762 merged by jenkins-bot:
Special:NewPages - add <span> for "originally created as..."

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

Reedy closed this task as Resolved.Oct 2 2016, 7:18 PM
Reedy assigned this task to Sidhant-gupta-004.