Fixed path to the latest diff (and handle case when there is only 1 revision)

DanielTheViking - March 26, 2008 - 19:10
Project:Diff
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

IT would be practical to be able to make a menu entry pointing to a nodes "latest diff", meaning a URL that goes directly to the view of the current revision against the previous revision. (does this exist already? Then please enlighten me...)

So instead of having to alter the numbers (node/123/revisions/view/331/351), it could support something like node/123/revisions/view/latest
or
node/123/revisions/view/current

#1

moshe weitzman - March 26, 2008 - 19:14

How would you expose this feature in the UI? How would you use it?

#2

DanielTheViking - March 27, 2008 - 16:21

Simply make a menu entry or link to it from anywhere.
The point is to be able to not know which revision numbers are the current and the previous version, as they change dynamically.
Would be practical to have a link that pointed to the diff view of whicever is the last two revisions (current and previous). Exactly what it suggest when you enter the diff page: the two topmost revisions are always selected. When pressing "show diff" you get to that page, but next time that URL is different, if there are new revisions. So how about making a url dedicated to show the diff of the last two? The "UI" is no different, only the page we get today when clicking on show diff.

No problem if such a URL is redirecting to the normal URL style with both revision numbers in it, but the function I suggest is simply one url that will trigger a lookup to find out which are the two latest, then go straight to that "show diff" page. That URL should only contain the node id and a logical word so it is easy to rememember when making such links to several nodes.

#3

moshe weitzman - May 22, 2008 - 19:09
Version:5.x-2.x-dev» 6.x-2.x-dev

#4

moshe weitzman - August 31, 2008 - 20:33
Status:active» fixed

Committed to 5.x and 6.x. New version issued for 5.

#5

DanielTheViking - September 2, 2008 - 10:09

Great, works nicely - thanks a bunch - here is a related idea for an accompanying block:
http://drupal.org/node/302989

#6

DanielTheViking - September 2, 2008 - 10:42
Status:fixed» active

When placing links to selected nodes in a menu or block, sometimes the content manager does that to prepare for future work, not needing to wait for a minimum of two node revisions to exist for each node listed, but simply placing the nodes there so that work can commence.

With the current code, when visiting a link to a node that does not have two revisions, it returns the "access denied" page.
Instead, it should redirect to the current revision, preferably with a message on top informing that only one revision exist.

#7

moshe weitzman - September 30, 2008 - 16:25
Title:Fixed path to the latest diff (current and previous versions)» Fixed path to the latest diff (and handle case when there is only 1 revision)

#8

smokris - June 1, 2009 - 20:27
Status:active» needs review

Here's a patch (against the latest 6.x-2.x-dev code) to handle the case where a node has only a single version.

AttachmentSize
diff-view-latest.patch 1017 bytes

#9

smokris - June 1, 2009 - 21:18

Relatedly, it would be handy to be able to easily construct a link that shows a diff between a specified vid and its predecessor.

For example, currently, to show what changed in vid 14 of node 7, you need to know that, for node 7, the previous vid was 5: node/7/revisions/view/5/14

Attached is a patch that implements an alternate syntax for this situation: node/7/revisions/view/14 --- so that you only need to know the target vid. (This patch includes the previous patch.)

AttachmentSize
diff-view-latest-and-predecessor.patch 1.93 KB

#10

smokris - June 2, 2009 - 15:45

Here's a slight revision to the last patch, to make use of _diff_get_previous_vid().

AttachmentSize
diff-view-latest-and-predecessor-01.patch 1.86 KB
 
 

Drupal is a registered trademark of Dries Buytaert.