Edgewall Software

Ticket #3928 (closed defect: fixed)

Opened 3 years ago

Last modified 17 months ago

Warning message in Wiki Delete

Reported by: trac-ja@… Owned by: cboos
Priority: normal Milestone: 0.11
Component: wiki system Version: 0.10
Severity: minor Keywords:
Cc:

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

Change History

Changed 3 years ago by cboos

  • severity changed from normal to minor

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 ...)

Changed 3 years ago by trac-ja@…

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 

Changed 17 months ago by osimons

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 0.10.5 to 0.11

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

BTW: See #4112 for a closely related discussion.

Add/Change #3928 (Warning message in Wiki Delete)

Author


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


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.