From 8eb5cba4ec9b02ae7791eded9670a769697ffb7f Mon Sep 17 00:00:00 2001 From: Chad Birch Date: Mon, 15 Apr 2013 15:55:06 -0600 Subject: [PATCH] Prevent replying to removed comments (Except author, mod, or admin) --- r2/r2/lib/validator/validator.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/r2/r2/lib/validator/validator.py b/r2/r2/lib/validator/validator.py index 035e8124b..30080b6f1 100644 --- a/r2/r2/lib/validator/validator.py +++ b/r2/r2/lib/validator/validator.py @@ -942,6 +942,14 @@ class VSubmitParent(VByName): self.set_error(errors.DELETED_LINK) else: self.set_error(errors.DELETED_COMMENT) + if parent._spam and isinstance(parent, Comment): + # Only author, mod or admin can reply to removed comments + can_reply = (c.user_is_loggedin and + (parent.author_id == c.user._id or + c.user_is_admin or + parent.subreddit_slow.is_moderator(c.user))) + if not can_reply: + self.set_error(errors.DELETED_COMMENT) if isinstance(parent, Message): return parent else: