mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
AutoMod: ensure comment on a post sends orangered
Normally, if a moderator leaves a top-level comment on a post and distinguishes it, we send an orangered to the author of the post even if they have "send replies to my inbox" disabled for that post. This is done since a distinguished top-level comment is often used to give important information to the author (such as why the post was removed). However, since AutoMod distinguishes its comments "directly" by just setting the attribute, this logic wasn't being checked for its comments, and it hasn't been sending orangereds in cases where it should be. This commit fixes that, and ensures that it'll always send one whenever it's commenting on a post.
This commit is contained in:
@@ -66,6 +66,7 @@ from r2.models import (
|
||||
Comment,
|
||||
DeletedUser,
|
||||
Frontpage,
|
||||
Inbox,
|
||||
LastModified,
|
||||
Link,
|
||||
Message,
|
||||
@@ -1432,6 +1433,14 @@ class Rule(object):
|
||||
new_comment.distinguished = "yes"
|
||||
new_comment.sendreplies = False
|
||||
new_comment._commit()
|
||||
|
||||
# If the comment isn't going to be put into the user's inbox
|
||||
# due to them having sendreplies disabled, force it. For a normal
|
||||
# mod, distinguishing the comment would do this, but it doesn't
|
||||
# happen here since we're setting .distinguished directly.
|
||||
if isinstance(item, Link) and not inbox_rel:
|
||||
inbox_rel = Inbox._add(data["author"], new_comment, "selfreply")
|
||||
|
||||
queries.new_comment(new_comment, inbox_rel)
|
||||
|
||||
if self.comment_stickied:
|
||||
|
||||
Reference in New Issue
Block a user