Edgewall Software
Modify

Ticket #3263 (closed enhancement: fixed)

Opened 6 years ago

Last modified 6 years ago

Timeline should show link to diff of wiki page changes

Reported by: Simon Willison Owned by: jonas
Priority: normal Milestone: 0.10
Component: timeline Version: 0.9.5
Severity: minor Keywords:
Cc:
Release Notes:
API Changes:

Description

When a wiki page has been changed, it's very useful to go to the page history for that page and view the diff between the current and previous versions. It would be great if the Trac timeline linked directly to this diff - not from the main link itself, but from an additional diff link listed with the timeline entry. Something a bit like this:

15:48 SandBox edited by anonymous (diff)

Attachments

wiki_timeline_event_diff_link-r3412.patch (2.3 KB) - added by cboos 6 years ago.
Implements (diff) links, added after the change comment.
wiki_timeline_event_diff_link-r3417.patch (1.9 KB) - added by cboos 6 years ago.
Updated patch, using Markup instead of Fragment.

Download all attachments as: .zip

Change History

comment:1 Changed 6 years ago by cboos

  • Resolution set to duplicate
  • Status changed from new to closed

The timeline entry is itself a link, so it's not possible to have a sublink.
The suggestion to link to the diff was actually already made in #239.

comment:2 Changed 6 years ago by Simon Willison

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Having looked over the code that deals with timeline events, it seems that it's not possible to include an extra link in the title. However, it should be possible to include the link in the comment field, producing something that looks like this:

16:44 SandBox edited by anonymous
removed spam (diff)

comment:3 Changed 6 years ago by cboos

OK, that would be possible.

However, wouldn't it be better to actually always jump to the diff page,
unless it's a created page?
From there, its to jump to the latest version and, soon, the travel
to the previous/next changes (see #3250).

In the future, the Wiki diff page could even show the changes inline,
in the produced HTML.

Changed 6 years ago by cboos

Implements (diff) links, added after the change comment.

comment:4 Changed 6 years ago by cboos

  • Keywords review added
  • Milestone set to 0.10
  • Severity changed from normal to minor

Here's what I think could be done:

  1. attachment:wiki_timeline_event_diff_link-r3412.patch for now,
  2. when/if we have the ability to render wiki page to HTML, with highlighted diffs (i.e. <INS> and <DEL> tags) remove the diff link and directly redirect to the full page with those highlighted diffs.

Tentatively scheduling for 0.10, if 1. is accepted.

comment:5 Changed 6 years ago by cmlenz

I don't like the direct use of the Fragment class in that patch. Wouldn't something like the following work (not tested):

    if version > 1:
        diff_link = html.A('diff', href=href.wiki(
            name, action='diff', version=version,
            old_version=version-1))
        comment = Markup('%s (%s)', comment, diff_link)

Changed 6 years ago by cboos

Updated patch, using Markup instead of Fragment.

comment:6 Changed 6 years ago by cboos

Well, no, that wouldn't work right now, as the Element gets first converted
to an unicode string, then gets escaped.
But of course, we could change that, and leave the Element untouched,
as we would do for Markup objects, which makes sense IMO.

Updated patch attachment:wiki_timeline_event_diff_link-r3417.patch

comment:7 Changed 6 years ago by cboos

  • Keywords review removed

Maybe this feature is not so useful anymore, as there's now the Last Change
link in the navigation links of the wiki page.

Please try out and tell me if you think the (diff) link would still be needed.

comment:8 Changed 6 years ago by cboos

  • Resolution set to fixed
  • Status changed from reopened to closed

Well, after some more thought on this, I still think it's useful.

E.g. if I notice that the TracFaq page has been modified on p.e.c,
I don't really want to see it in full, rather I'm only interested
to see what has changed.

So even now with the Last Change link on the Wiki view page,
a quick (diff) link in the timeline has still its use for
by-passing a (sometimes long) rendering phase of the Wiki page.

Therefore, I implemented this in r3482.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from jonas. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.