Edgewall Software
Modify

Opened 18 years ago

Closed 17 years ago

#3928 closed defect (fixed)

Warning message in Wiki Delete

Reported by: trac-ja@… Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: wiki system Version: 0.10
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Clicking Delete this version button in a wiki page, warning message (This is the only version the page, so the page will be removed completely!) is displayed, although there are multiple versions in that wiki page.

When this patch is applied, it will improve:

  • trac/wiki/web_ui.py

     
    254254        self._set_title(req, page, 'delete')
    255255        req.hdf['wiki'] = {'mode': 'delete'}
    256256        if version is not None:
    257             num_versions = 0
    258             for v,t,author,comment,ipnr in page.get_history():
    259                 if v >= old_version:
    260                     num_versions += 1;
    261                     if num_versions > 1:
    262                         break
    263257            req.hdf['wiki'] = {'version': version, 'old_version': old_version,
    264                                'only_version': num_versions == 1}
     258                               'only_version': (old_version == 1 and version == 1)}
    265259
    266260    def _render_diff(self, req, db, page):
    267261        req.perm.assert_permission('WIKI_VIEW')

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 18 years ago

Severity: normalminor

Well, the loop you removed was there in case the version 1 got deleted somehow, but this is no longer possible due to the current restrictions that prevent removing arbitrary versions in the middle of the history. r3875 seems to be based on the same assumption, so I guess we can move in that direction (still there might be existing Trac Wikis lacking a version 1 …)

comment:2 by trac-ja@…, 18 years ago

I understand. There're Wiki pages missing version 1. However, page.get_history() yeilds only one record-set when the page to be deleted has any version number, I think.

This is a patch for source:branches/0.10-stable@3941 :

  • trac/wiki/web_ui.py

     
    256256        if version is not None:
    257257            num_versions = 0
    258258            for v,t,author,comment,ipnr in page.get_history():
    259                 if v >= old_version:
    260                     num_versions += 1;
    261                     if num_versions > 1:
    262                         break
     259                num_versions += 1;
     260                if num_versions > 1:
     261                    break
    263262            req.hdf['wiki'] = {'version': version, 'old_version': old_version,
    264263                               'only_version': num_versions == 1}
    265264

comment:3 by osimons, 17 years ago

Milestone: 0.10.50.11
Resolution: fixed
Status: newclosed

This seems to be fixed as [5386:5387]. Closing.

BTW: See #4112 for a closely related discussion.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.