-
Notifications
You must be signed in to change notification settings - Fork 50
refactor: improve filter logic and efficiency #484
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
Conversation
Signed-off-by: Kyra <[email protected]>
Ignore the failed test workflow. I would need to check this before I have any opinion on merging. If others, e.g. TheCommCraft say it's good, then that's ok too. |
alright thanks |
i'll try checking this out right now. How thoroughly have you tested this? |
feat: return from comment.delete feat: log message and headers of deletion request fix: return response, not headers from project delete comment TimMcCool#497 fix: no error handling on user delete comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i made a few fixes. It works on my machine (i've been testing here, and my f4f/ad comments are getting deleted, which indicates that the Hardfilters and Softfilters are working as expected.
I will just test Spamfilter, then ask TheCommCraft for any comments.
f"https://api.scratch.mit.edu/proxy/comments/project/{self.id}/comment/{comment_id}/", | ||
headers=self._headers, | ||
cookies=self._cookies, | ||
).headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the headers here so that both project.delete_comment and user.delete_comment return a requests.response object. see #497
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spam filter works. @TheCommCraft, any comments?
I've updated the filterbot.py file to use
collections.deque
to improve the logic and efficiency of the bot. This gives more readable and maintainable code.I also simplified some of the simple logic flow, e.g. this if block to a less messy 3-liner.
I also reformatted a couple of small things within filterbot.py