From df67499a35a70d9623e2b4b53aa5cbaafc5ce92b Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 13 Feb 2013 15:52:47 -0500 Subject: [PATCH] humbug_trac: Make which field changes cause notifications customizable. (imported from commit 91b138a0eaf3c3773752ae3a4c4599bd5c095497) --- bots/humbug_trac_config.py | 20 ++++++++++++++++++-- integrations/humbug_trac.py | 4 +--- integrations/humbug_trac_config.py | 20 ++++++++++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/bots/humbug_trac_config.py b/bots/humbug_trac_config.py index 7ab1542..e051f1f 100644 --- a/bots/humbug_trac_config.py +++ b/bots/humbug_trac_config.py @@ -26,8 +26,24 @@ HUMBUG_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" STREAM_FOR_NOTIFICATIONS = "trac" TRAC_BASE_TICKET_URL = "https://trac.humbughq.com/ticket" -# This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://staging.humbughq.com" +# Most people find that having every change in Trac result in a +# notification is too noisy -- in particular, when someone goes +# through recategorizing a bunch of tickets, that can often be noisy +# and annoying. We solve this issue by only sending a notification if +# one of the more important fields is changed or the person making the +# change makes a comment. +# +# Total list of fields is: +# (priority, milestone, cc, owner, keywords, component, severity, +# type, versions, description, resolution, summary) +# +# The following is the list of fields which can be changed without +# triggering a Humbug notification +TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution"] + ## If properly installed, the Humbug API should be in your import ## path, but if not, set a custom path below HUMBUG_API_PATH = "/home/humbug/humbug/api" + +# This should not need to change unless you have a custom Humbug subdomain. +HUMBUG_SITE = "https://staging.humbughq.com" diff --git a/integrations/humbug_trac.py b/integrations/humbug_trac.py index 2952996..280b28b 100644 --- a/integrations/humbug_trac.py +++ b/integrations/humbug_trac.py @@ -89,9 +89,7 @@ class HumbugPlugin(Component): `old_values` is a dictionary containing the previous values of the fields that have changed. """ - if not comment and set(old_values.keys()) <= set(["priority", "milestone", - "cc", "keywords", - "component"]): + if not comment and not set(old_values.keys()).intersection(set(config.TRAC_NOTIFY_FIELDS)): # This is probably someone going through trac and updating # the priorities; this can result in a lot of messages # nobody wants to read, so don't send them without a comment. diff --git a/integrations/humbug_trac_config.py b/integrations/humbug_trac_config.py index eb9df79..1f46379 100644 --- a/integrations/humbug_trac_config.py +++ b/integrations/humbug_trac_config.py @@ -28,8 +28,24 @@ HUMBUG_API_KEY = "0123456789abcdef0123456789abcdef" STREAM_FOR_NOTIFICATIONS = "trac" TRAC_BASE_TICKET_URL = "https://trac.example.com/ticket" -# This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +# Most people find that having every change in Trac result in a +# notification is too noisy -- in particular, when someone goes +# through recategorizing a bunch of tickets, that can often be noisy +# and annoying. We solve this issue by only sending a notification if +# one of the more important fields is changed or the person making the +# change makes a comment. +# +# Total list of fields is: +# (priority, milestone, cc, owner, keywords, component, severity, +# type, versions, description, resolution, summary) +# +# The following is the list of fields which can be changed without +# triggering a Humbug notification +TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution"] + ## If properly installed, the Humbug API should be in your import ## path, but if not, set a custom path below HUMBUG_API_PATH = None + +# This should not need to change unless you have a custom Humbug subdomain. +HUMBUG_SITE = "https://humbughq.com"