Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
AutoMod: don't approve things removed by mods
Browse files Browse the repository at this point in the history
This was mostly already covered by the check in should_check_item that
makes AutoMod skip over items that have been removed by moderators, but
it didn't cover rules that triggered on a comment and used that to
approve the parent submission. Rules using that sort of check/action
would cause parent submissions that had previously been removed by
moderators to be re-approved, which isn't desirable.
  • Loading branch information
Deimos committed Jun 1, 2015
1 parent 085ebb7 commit 909496c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions r2/r2/lib/automoderator.py
Expand Up @@ -927,8 +927,12 @@ def check_match_patterns(self, item, data):

def perform_actions(self, item, data):
"""Execute the defined actions on the item."""
# only approve if it's currently removed or reported
should_approve = item._spam or (self.reports and item.reported)
# only approve if it's currently removed or reported, and hasn't
# been removed by a moderator
ban_info = getattr(item, "ban_info", {})
mod_banned = ban_info.get("moderator_banned")
should_approve = ((item._spam and not mod_banned) or
(self.reports and item.reported))
if self.action == "approve" and should_approve:
approvable_author = not data["author"]._spam or self.approve_banned
if approvable_author:
Expand Down

0 comments on commit 909496c

Please sign in to comment.