{"id":57,"date":"2011-08-17T23:55:13","date_gmt":"2011-08-18T03:55:13","guid":{"rendered":"http:\/\/www.jetmore.org\/john\/blog\/?p=57"},"modified":"2012-05-11T15:16:45","modified_gmt":"2012-05-11T19:16:45","slug":"enforcing-a-default-owner-for-new-tickets-in-trac","status":"publish","type":"post","link":"https:\/\/www.jetmore.org\/john\/blog\/2011\/08\/enforcing-a-default-owner-for-new-tickets-in-trac\/","title":{"rendered":"Enforcing a default owner for new tickets in Trac"},"content":{"rendered":"<p>We&#8217;ve been loving our Trac install at work, but we are still sanding down a few rough spots. \u00a0One particular spot that&#8217;s been bobbing up has been what happens when &#8220;new&#8221; tickets have an owner assigned. \u00a0I liked the ticket status being &#8220;new&#8221;, because it meant that I could easily look at my ticket list and see tickets that had been directly assigned to me that I hadn&#8217;t acknowledged yet by accepting them. \u00a0Someone else really disliked having to &#8220;accept&#8221; a ticket that was already assigned to him before he could move it to QA.<\/p>\n<p>I actually managed to create a solution for this using the\u00a0<a href=\"http:\/\/trac-hacks.org\/wiki\/TicketConditionalCreationStatusPlugin\">TicketConditionalCreationStatusPlugin<\/a>\u00a0from TracHacks. \u00a0This plugin allowed me to conditionally set the status of the ticket based on the contents of the &#8220;owner&#8221; field. \u00a0This was actually a pretty slick solution, but for various reasons it didn&#8217;t sit well with a lot of people.<\/p>\n<p>The next idea we had was to prevent new tickets from being created with any owner besides the default value of &#8220;dev&#8221; (our dev team mailing list). \u00a0This solution had three main benefits &#8211; It worked the same for everyone; no one would ever have a &#8220;new&#8221; ticket assigned to them; and the &#8220;dev&#8221; alias was always associated with a new ticket, which has some value in relation to email notifications.<\/p>\n<p>Easy enough, right? \u00a0Maybe it&#8217;s just me, but I could not find a good way to enforce this. \u00a0There&#8217;s no native ability to hide fields that aren&#8217;t drop-downs, and owner&#8217;s not a drop down by default. \u00a0It can be made a drop-down, but not in a manner which would allow it to be removed. \u00a0There are several owner-oriented plugins, but none of them differentiate between the &#8220;new ticket&#8221; screen and the &#8220;modify ticket&#8221; screen.<\/p>\n<p>After a bit of fruitless experimentation I realized that I was overthinking it. \u00a0I made the following change:<\/p>\n<pre class=\"brush: diff; light: true; title: templates\/site.html; notranslate\" title=\"templates\/site.html\">\r\n- &lt;body py:match=&quot;body&quot; py:attrs=&quot;select('@*')&quot;&gt;\r\n+ &lt;body onload='document.getElementById(&quot;field-owner&quot;).disabled = true;' py:match=&quot;body&quot; py:attrs=&quot;select('@*')&quot;&gt;\r\n<\/pre>\n<p>et voila! \u00a0My default owner value is visible but immutable!<\/p>\n<p>I know this isn&#8217;t a rock-solid solution, but in our environment (restricted corporate access) I&#8217;m not worried about evil-doers and griefers, I&#8217;m just wanting to remind people that they&#8217;re not supposed to change the value&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve been loving our Trac install at work, but we are still sanding down a few rough spots. \u00a0One particular spot that&#8217;s been bobbing up has been what happens when &#8220;new&#8221; tickets have an owner assigned. \u00a0I liked the ticket &hellip; <a href=\"https:\/\/www.jetmore.org\/john\/blog\/2011\/08\/enforcing-a-default-owner-for-new-tickets-in-trac\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[8,14],"_links":{"self":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts\/57"}],"collection":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":3,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts\/57\/revisions\/692"}],"wp:attachment":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}