From 0dadb5d505363b4d83ad995bf390bc43bdb5fed2 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 14 Jan 2015 09:03:23 -0500 Subject: [PATCH 1/2] Actually, just ignore all my own bodhi activity. No need to see my own comments. --- fmn/lib/defaults.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fmn/lib/defaults.py b/fmn/lib/defaults.py index b2b7c08..3653707 100644 --- a/fmn/lib/defaults.py +++ b/fmn/lib/defaults.py @@ -25,15 +25,7 @@ # Don't tell me about my own bodhi activity, but do tell me if other people # do bodhi stuff to my packages. - 'bodhi_buildroot_override_untag', - 'bodhi_buildroot_override_tag', - 'bodhi_update_request_stable', - 'bodhi_update_request_obsolete', - 'bodhi_update_request_testing', - 'bodhi_update_request_unpush', - 'bodhi_update_request_revoke', - ## Except, comments. Comments are nice to get. - #'bodhi_update_comment', + 'bodhi_catchall', # Don't tell me about my own bugzilla activity, but I do want to know if # other people act on bugs on my packages. From 811054e24c2c4bafb2e438dac27bda2e586c6171 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 14 Jan 2015 09:45:32 -0500 Subject: [PATCH 2/2] Add a default filter to catch username mentions. I tested this pattern with the following script: ```python import re hits = [ "Let's wait for @ralph.", "'@ralph?", "'@ralph'", "And then I was like '@ralph won't care.'", "This is a test for @ralph right?", "This guy, @ralph, is a guy.", ] misses = [ "This is a @string", "@shmalf", "ralph", "this is a string with ralph in it." "butts@ralph.org", "This is not valid @@ralph", ] pattern = "[!-~ ]*[^\w@]@ralph[^\w@][!-~ ]*" for hit in hits: if re.match(pattern, hit): print "+ %r" % hit else: print "- %r" % hit for miss in misses: if re.match(pattern, miss): print "- %r" % miss else: print "+ %r" % miss ``` --- fmn/lib/defaults.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fmn/lib/defaults.py b/fmn/lib/defaults.py index 3653707..e0320b1 100644 --- a/fmn/lib/defaults.py +++ b/fmn/lib/defaults.py @@ -220,7 +220,7 @@ def contexts(): else: log.warn("No such context %r is in the DB." % name) - # For each context, build two big filters + # For each context, build one little and two big filters for context in contexts(): pref = fmn.lib.models.Preference.load(session, user, context) if not pref: @@ -228,6 +228,15 @@ def contexts(): pref = fmn.lib.models.Preference.create( session, user, context, detail_value=value) + # Add a special filter that looks for mentions like @ralph + filt = fmn.lib.models.Filter.create( + session, "Mentions of my @username") + pattern = '[!-~ ]*[^\w@]@%s[^\w@][!-~ ]*' % nick + filt.add_rule(session, valid_paths, + "fmn.rules:regex_filter", pattern=pattern) + pref.add_filter(session, filt, notify=True) + # END @username filter + # Add a filter that looks for packages of this user filt = fmn.lib.models.Filter.create( session, "Events on packages that I own")