Skip to content

Commit

Permalink
AutoMod: fix RuleTarget matches not being cleared
Browse files Browse the repository at this point in the history
A RuleTarget's matches dict (which stores the results of the search
checks on that item) was only being cleared in the __init__ function, so
it was actually being retained across checks against multiple different
items. This meant that {{match}} placeholders would occasionally be
replaced by the result of a match from an entirely different item. This
change makes it so that the matches will be cleared at the start of each
check instead.
  • Loading branch information
Deimos committed May 20, 2015
1 parent 9e4d166 commit 31a597c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions r2/r2/lib/automoderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@ def check_match_patterns(self, item, data):
if len(self.match_patterns) == 0:
return True

self.matches = {}
match = None
checked_anything = False
for key, match_pattern in self.match_patterns.iteritems():
Expand Down

0 comments on commit 31a597c

Please sign in to comment.