Page MenuHomePhabricator

Section links on history and diff pages should be permalinks (with &oldid=)
Open, LowPublic

Description

Links generated by /* section */ in summary should include &oldid= parameter.

Details

Reference
bz24783

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:09 PM
bzimport set Reference to bz24783.
bzimport added a subscriber: Unknown Object (MLST).

Here's an interesting thought. Instead of &oldid= how about we add in a new &= parameter that takes a timestamp and gives the best revision it can find for said page at that timestamp. Then we make all [[links]] inside of edit summaries include a timestamp that matches the edit. Then all links will generally point to a fairly good representation of what the page was like at that point in time.

A snippet of JavaScript such as the following should provide the requested functionality:

$(function(){
	mw.loader.using('mediawiki.util',function(){
		var	$list = $('#pagehistory').find('li'),
			$sectionLink = $list.find('.autocomment a'),
			oldUrl = $list.find('> a').attr('href');		
		$sectionLink.attr('href', function(i, val) {
			var parts = val.split( '#', 2 );
			return parts.join( '?oldid=' + mw.util.getParamValue('oldid', oldUrl ) + '#' );
		});
	});
});