Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#10099 closed enhancement (fixed)

Simplify reverting a wiki page to an earlier version

Reported by: rblank Owned by: rblank
Priority: high Milestone: 1.0
Component: wiki system Version:
Severity: normal Keywords:
Cc:
Release Notes:

wiki: Simplified reverting of a wiki page to an older version.

API Changes:

Description

I may be missing something obvious, but reverting a wiki page to a previous version currently involves the following procedure:

  • Display the version to revert to.
  • Download the source text as "Plain Text".
  • Edit the page, delete the text and paste the downloaded text.

I would have expected that clicking on "Edit this page" on an old version would show the editor with the old text, but this is not the case.

I suggest changing the "Edit this page" button into "Revert to this version" when viewing an old version of a page, and to behave as expected above when that button is clicked.

Patch coming up shortly.

Attachments (1)

10099-wiki-revert-r10656.patch (3.9 KB) - added by rblank 4 years ago.
Suggested fix.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 4 years ago by cboos

What I usually do is simply to delete the unwanted latest versions.

But it's true that there are situations when the change to revert is not vandalism but simply a wrong information, and restoring the previous content is better accompanied in this case by a comment stating why the change was reverted.

In addition, with alternative TracDev/Proposals/WikiStorage that don't support version deletion, this feature will be the only way to quickly revert vandalism.

Last edited 3 years ago by shoffmann (previous) (diff)

Changed 4 years ago by rblank

Suggested fix.

comment:2 Changed 4 years ago by rblank

10099-wiki-revert-r10656.patch changes the "Edit this page" to "Revert to this version" when viewing an older version of a wiki page. When clicking the button, it opens the editor for a new version, with the text from the old version. From there, all the usual operations are possible, like viewing the diff.

(The big hunk in wiki_view.html around the "Delete" button is only a simplification and has nothing to do with this functionality.)

comment:3 Changed 4 years ago by cboos

Looks good, successfully tested.

One thing's missing though: the UEB support! Clicking on the UniversalEditButton makes you edit the latest version, as before. I think that for consistency it should also make you revert to the version being viewed.

  • trac/wiki/templates/wiki_view.html

    diff -r 7c397fb1b559 trac/wiki/templates/wiki_view.html
    a b  
    1212    <title py:if="title">$title</title> 
    1313    <meta py:if="version or page.author == 'trac'" name="ROBOTS" content="NOINDEX, NOFOLLOW" /> 
    1414    <link py:if="admin_perm or (not page.readonly and modify_perm)" rel="alternate" type="application/x-wiki" 
    15           title="Edit this page" href="${href.wiki(page.name, action='edit')}" /> 
     15          title="Edit this page" href="${href.wiki(page.name, action='edit', version=version)}" /> 
    1616    <script type="text/javascript"> 
    1717      jQuery(document).ready(function($) { 
    1818        $("#content").find("h1,h2,h3,h4,h5,h6").addAnchor(_("Link to this section")); 

comment:4 Changed 4 years ago by rblank

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

Good catch! Thanks for testing. I have also changed the title of the link in the case where it would edit an old version of the page.

Patch committed in [10659].

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed The owner will remain rblank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from rblank to the specified user.
Author


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

 
Note: See TracTickets for help on using tickets.