-
Notifications
You must be signed in to change notification settings - Fork 57
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
Let's port to Synapse module API #128
Conversation
12ea36c
to
4eac9a1
Compare
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.
it looks like python, but I'm not the best person to review python. Would recommend seeking backend review as well.
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.
Remember you'll need to update the documentation for how the module should be installed.
It looks like this change will make the module incompatible with the old API. I recommend supporting both the new API at the same time as the old one, at least for a while, so that we don't need to deploy code and config changes at the same time.
One way to do that is to leave AntiSpam
as it is today - complete with definitions of all the methods like user_may_create_room
required to implement the old module api - and to define a new class (for example mjolnir.Mjolnir
) - which implements the new api and just wraps AntiSpam
.
4eac9a1
to
07cb181
Compare
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.
Could we add the mx-tester build step to github actions?
Ok, ofc we already have mx-tester build in the CI |
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.
lgtm, except for your implementation of check_username_for_spam
which has an error.
A few suggestions/comments though.
synapse_antispam/mjolnir/antispam.py
Outdated
class AntiSpam(object): | ||
def __init__(self, config, api): | ||
self.block_invites = config.get("block_invites", True) | ||
self.block_messages = config.get("block_messages", False) | ||
self.block_usernames = config.get("block_usernames", False) | ||
self.list_room_ids = config.get("ban_lists", []) | ||
self.rooms_to_lists = {} # type: Dict[str, BanList] |
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.
is this no longer correct, or?
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.
Well, importing Dict
isn't correct anymore, so I guess that this isn't either?
No description provided.