refactor: improve filter logic and efficiency#484
Conversation
Signed-off-by: Kyra <162041796+kyrazzx@users.noreply.github.com>
|
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
faretek1
left a comment
There was a problem hiding this comment.
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.
I removed the headers here so that both project.delete_comment and user.delete_comment return a requests.response object. see #497
faretek1
left a comment
There was a problem hiding this comment.
spam filter works. @TheCommCraft, any comments?
I've updated the filterbot.py file to use
collections.dequeto 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