Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Still more defaults tweaking #30

Merged
merged 2 commits into from
Jan 14, 2015
Merged

Conversation

ralphbean
Copy link
Contributor

First, in 0dadb5d I change/simplify the username filter to just ignore all my
own bodhi activity. No need to see my own comments.

Secondly, in 811054e I add a default filter to catch username mentions.
I tested the pattern with the following script:

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

No need to see my own comments.
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
```
@ralphbean
Copy link
Contributor Author

Oh, and that bodhi_catchall rule is added in fedora-infra/fmn.rules#32.

pattern = '[!-~ ]*[^\w@]@%s[^\w@][!-~ ]*' % nick
filt.add_rule(session, valid_paths,
"fmn.rules:regex_filter", pattern=pattern)
pref.add_filter(session, filt, notify=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet :)

@pypingou
Copy link
Member

nice 👍

ralphbean added a commit that referenced this pull request Jan 14, 2015
@ralphbean ralphbean merged commit 962c9ec into develop Jan 14, 2015
@ralphbean ralphbean deleted the feature/still-more-default-tweaking branch January 14, 2015 15:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants