you are viewing a single comment's thread.

view the rest of the comments →

[–]teelo 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (3 children)

Theres this bit in listingcontroller.py, line 1750:

class CommentsController(SubredditListingController):
title_text = _('comments')

def keep_fn(self):
    def keep(item):
        if c.user_is_admin:
            return True

        if item._deleted:
            return False

        if isinstance(c.site, FriendsSR):
            if item.author._deleted or item.author._spam:
                return False

        if c.user_is_loggedin:
            if item.subreddit.is_moderator(c.user):
                return True

            if item.author_id == c.user._id:
                return True

        if item._spam:
            return False
        return item.keep_item(item)
    return keep

But that only checks for deleted (by the author, I presume) or if its marked spam. Do moderator removals just mark comments as spam?

I wouldn't know how to send the extra parameter or detect it. Not a python dev.

[–]magnora7[S] 4 insightful - 2 fun4 insightful - 1 fun5 insightful - 2 fun -  (2 children)

Marking spam and removing are separate operations an admin can do to remove a comment. I am not sure the difference between the two, honestly. Maybe when it's removed it does mark it as item._spam. Does item._removed exist as a classifier, I wonder?

The code bit you pointed out looks very close to what we need though, you're definitely hot on the trail

[–]teelo 3 insightful - 2 fun3 insightful - 1 fun4 insightful - 2 fun -  (1 child)

Does item._removed exist as a classifier

I think this will answer that question for us! test_validator.py, 237:

    def test_removed_comment(self):
    comment = self._mock_comment(_spam=True)
    result = self.validator.run('fullname', None)

    self.assertEqual(result, comment)
    self.assertTrue(self.validator.has_errors)
    self.assertIn((errors.DELETED_COMMENT, None), c.errors)

(I searched "_remove" and no results outside of the jQuery libraries)

[–]magnora7[S] 5 insightful - 2 fun5 insightful - 1 fun6 insightful - 2 fun -  (0 children)

Alright looks like a pretty promising start! I think this is about half the info needed to make this thing happen, thanks for your help so far! I'll add this thread to our to-do list so we can reference it later when we try to build the feature out fully