Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New/No OP Reply system (Pull this one, not the other one) #50

Closed
wants to merge 2 commits into from

Conversation

Pluckerpluck
Copy link

This pull request adds the No OP Replies system. Please test this thoroughly yourself as there's only so much testing a single person can do.

Basically all submissions are marked with the "new_flair" (if they are young enough). This MUST contain a css_class but the text can be blank if you wish it to be (so a hidden flair basically).

When an OP replies a hidden css_class is incremented. This allows the number of replies to be stored online without worrying about keeping count locally.

After a set amount of time the new tag is removed and the comment is check to see if it has more repelies than "replies_required". If so the new tag is removed (though the number of replies is still secretly counted in case you ever want to use this in another way). If not they are marked with the "no_op_replies_flair".

If marked as such, replying enough times will remove the flair.

As far as I can tell this should have 1 API call for the thread search and 2 API call per OP reply (necessary to get the submission + update the flair). So it shouldn't be too bad.

This commit adds the No OP Replies system.

All submissions are marked as new and the number of OP posts are
recorded (in a hidden CSS class).

This new tag lasts for a set amount of time after which it will be
decided whether the post has enough replies or not.

It also checks submissions marked as No Replies for updates.
@chrisuehlinger
Copy link
Contributor

Looks great, and thanks for managing the side effects well!

@Pluckerpluck
Copy link
Author

Edit: Turns out you can commit changes online when they're still in a pull request. I have made the change so it should work now.


OH GOD! There is a fatal flaw in this! (Quick fix, someone else will need to do it as I'm busy)

check_for_OP_reply() returns a submission even if it shouldn't be incremented. Basically every reply is an OP reply.

the returned submission should be None if it's not an OP reply.

That being said I can't do this as I'm super busy (not enough time to deal with git). It's a really quick fix though.

def check_for_OP_reply(self, comment):
    log = "Not OP, reply count not increased"
    submission = None
    if comment.link_author == comment.author.name:
        log = "OP has replied, increasing reply count"
        submission = comment.submission
    return (log, submission)

Also, it's probably worth checking in this function if comment.parent_id belongs to a comment or a submission (based on the id type). We probably don't want to count top level replies.

Accidentally has check_for_OP_reply() returning a submission to increment whether or not the OP replied. I have now fixed this (simple fix, but I didn't test it)
@PixelOrange
Copy link
Contributor

This pull can't be automatically merged because of the last pull anyway. I will probably manually implement it and include your fix at the same time.

On Feb 4, 2014, at 12:26 PM, Sammy Gillespie [email protected] wrote:

OH GOD!There is a fatal flaw in this! (Quick fix, someone else will need to do it as I'm busy)

check_for_OP_reply() returns a submission even if it shouldn't be incremented. Basically every reply is an OP reply.

the returned submission should be None if it's not an OP reply.

That being said I can't do this as I'm super busy (not enough time to deal with git). It's a really quick fix though.

def check_for_OP_reply(self, comment):
log = "Not OP, reply count not increased"
submission = None
if comment.link_author == comment.author.name:
log = "OP has replied, increasing reply count"
submission = comment.submission
return (log, submission)
Also, it's probably worth checking in this function if comment.parent_id belongs to a comment or a submission (based on the id type). We probably don't want to count top level replies.


Reply to this email directly or view it on GitHub.

@PixelOrange
Copy link
Contributor

Closed due to issue #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants