you are viewing a single comment's thread.

view the rest of the comments →

[–]teelo 4 insightful - 1 fun4 insightful - 0 fun5 insightful - 1 fun -  (12 children)

So, speaking of the moderator logs. I've noticed that its kinda useless for checking moderator actions when removing comments, when I can't actually see the comment that was removed anymore. The links in the moderator logs just direct to a "there doesn't seem to be anything here". How can I check if a moderator followed rule 4 if I can't see the comment they removed?

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

I see what you're saying, but I'm not sure what the alternative is. Just leave the comment up? If we leave every comment up that's removed, then what's the point of having moderators at all? You see what I mean?

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

Have a separate page that is only accessable via the moderator log to see what the comment was. Even just an expand button JSON query within the moderator log.

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

Not a bad idea. We've got a to-do list that's already 95 items long, and your project idea would probably take 5-10 hours minimum. I'll add it to the list. If someone wants to help, our code is all open source and we could use help to develop useful features like this.

[–]teelo 6 insightful - 1 fun6 insightful - 0 fun7 insightful - 1 fun -  (7 children)

Sure I can jump in and help. Just point me to the repo?

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

https://github.com/libertysoft3/saidit

Here you go sir. You could probably search "removed" in the codebase to find where to start finding the code for removed comments. I think the "removed" flag is written in to the database in its own column for each comment. Good luck, let me know if I can help

[–]teelo 5 insightful - 2 fun5 insightful - 1 fun6 insightful - 2 fun -  (5 children)

So I don't really know python, so I can't write the code, but I can certainly give some direction to what I suspect should work.

modaction.py, line 346:

if hasattr(item.target, "link_id"):
  parent_link_name = item.target.link_id
  item.parent_link = parent_links[parent_link_name]

Append something like "?frommodlog=true" to that item.parent_link, so that we send a _GET parameter to the comment page signalling that we're viewing it from the moderator log.

builder.py, line 1467:

def keep_item(self, item):
   if not self.show_deleted:
       if item.deleted and not item.num_children:
           return False
   return item.keep_item(item)

If I'm reading that right, if the item is flagged deleted, it returns false. So add a check for: 1) the _GET parameter we defined before, and 2) that the commentID in the URL matches this item. If it does, return True instead.

[–]magnora7[S] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (4 children)

Very nice, I'm impressed. I think your approach is good, to send an API add-on to display the comments page in "modlog" mode. Smart.

I am not quite sure you have the right lines in builder.py, but you're very close. I think that code is for deletions, when a user deletes a comment of their own volition. We are looking for removals, which is when an admin or mod removes the comment. I think the code to filter out removed comments would probably be around that area in builder.py too. If you find that part, then we'll practically have the solution.

Then lastly we'd have to figure out how to intercept the API call and do the correct action. routing.py has most of the API handling. So somehow that switch needs to be able to be flipped by the correct API call to a comment page.

Definitely getting close... keep going and we might actually get this feature developed!

[–]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

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

I'm new here but I second teelo's suggestion, sounds like a good idea.