Ticket #7142 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Remove Internal checkbox if ticket_policy is disabled

Reported by: josh@oxideinteractive.com.au Assigned to: 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

timingandestimation.diff (4.1 kB) - added by josh@oxideinteractive.com.au on 08/24/10 10:02:20.
Patch

Change History

08/23/10 04:51:49 changed by josh@oxideinteractive.com.au

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

08/23/10 19:28:16 changed by bobbysmith007

  • status changed from new to closed.
  • resolution set to fixed.

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

08/24/10 10:02:20 changed by josh@oxideinteractive.com.au

  • attachment timingandestimation.diff added.

Patch

08/24/10 10:05:07 changed by josh@oxideinteractive.com.au

  • status changed from closed to reopened.
  • resolution deleted.

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

08/24/10 15:25:08 changed by bobbysmith007

  • keywords set to patch.
  • status changed from reopened to closed.
  • resolution set to fixed.

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/Change #7142 (Remove Internal checkbox if ticket_policy is disabled)




Change Properties
Action