Modify

Opened 5 years ago

Closed 4 years ago

#7142 closed enhancement (fixed)

Remove Internal checkbox if ticket_policy is disabled

Reported by: josh@… Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 0.11

Description

If the timingandestimationplugin.ticket_policy component is disabled (which I am assuming is what deals with the Internal? checkbox), then could that checkbox be automatically removed? Or at the very least, not automatically add itself back in to the trac.ini file?

Attachments (1)

timingandestimation.diff (4.1 KB) - added by josh@… 4 years ago.
Patch

Download all attachments as: .zip

Change History (5)

comment:1 Changed 4 years ago by josh@…

Any chance of this happening? Or failing that, a point in the right direction so we can create a patch for it ourselves?

comment:2 Changed 4 years ago by bobbysmith007

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

I dont use this branch regularly (though I maintain and test it), and so have had not real pressing urge to do this. Is there a problem with simply setting its default to false and then hiding it with the permissions system from everyone?

UNDEBBUGED: something like this in trac.ini

[field settings]
fields = internal ...
interal.permissions = ALWAYS:hide

[ticket-custom]
internal.value = 0

If this somehow doesnt meet your need, please feel free to reopen this ticket.


If you actually want it gone, you will have to comment out the following lines in api.py then remove the config for the field from your trac.ini (and then hope that I didnt miss anyplace in this list)

# ln:164 ticket_fields_need_upgrade
                         self.config.get( ticket_custom, "internal") and \

# ln:195 - 207? do_ticket_field_upgrade
        if not self.config.get( ticket_custom, "internal"):
            self.config.set(ticket_custom, "internal", "checkbox")
            self.config.set(ticket_custom, "internal.value", "0")
            self.config.set(ticket_custom, "internal.label", "Internal?")
            self.config.set(ticket_custom,"internal.order", "5")

        if "InternalTicketsPolicy" not in self.config.getlist("trac", "permission_policies"):
            perms = ["InternalTicketsPolicy"]
            other_policies = self.config.getlist("trac", "permission_policies")
            if "DefaultPermissionPolicy" not in other_policies:
                perms.append("DefaultPermissionPolicy")
            perms.extend( other_policies )
            self.config.set("trac", "permission_policies", ', '.join(perms))

I hope this meets your needs, Russ Tyndall

Changed 4 years ago by josh@…

Patch

comment:3 Changed 4 years ago by josh@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

I've added a patch for the things I changed to achieve this - it's a little neater that your solution. Basically, I moved all the stuff to do with 'Internal' out into ticket_policy.py, so that disabling that gets rid of the field.

I may have missed a couple of bits in api.py, but I'm sure those won't be hard to fix up if you decide to use the patch.

(Feel free to reclose, just making sure you get the notification about it).

comment:4 Changed 4 years ago by bobbysmith007

  • Keywords patch added
  • Resolution set to fixed
  • Status changed from reopened to closed

Thanks for your patch, I will make note of it on the TimingAndEstimationPlugin page so it can be easily found by myself and others in the future.

Add Comment

Modify Ticket

Action
as closed The owner will remain bobbysmith007.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.