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

Shadow-ban command #57

Merged
merged 6 commits into from
Mar 4, 2022
Merged

Shadow-ban command #57

merged 6 commits into from
Mar 4, 2022

Conversation

Ascurius
Copy link
Collaborator

Hi JOJ0,

I quickly implemented a first appraoch to the shadow-ban command, based on your work. Hopefully this is useful to you.

If have tried to follow your documentation and command style. However, please let me know if my implementation approach does meet your requirements regarding documentation or command structure.

Additionally I added the env folder for virtual python environments to the .gitignore

@JOJ0
Copy link
Owner

JOJ0 commented Feb 24, 2022

Awesome! Please add the command to the checkbox list in readme.md.

You could also add a little more description to what it does exactly to the commands docstring which will then land up in --help. First line is what the user sees on main command -h, the rest is shown in subcommand -h

I usually steel bits and pieces from the synapse admin api docs, try to shorten. The goal is to be clear about what will happen but but not in all fancy detail like the synapse admin api docs.

@Ascurius
Copy link
Collaborator Author

I have added more description to the command (8a29b9b) and also added it to the command checkbox list in the README.md (3d27354)

Copy link
Owner

@JOJ0 JOJ0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. A view cosmetical changes, besides that LGTM and ready to merge :-)

synadm/api.py Outdated
""" Shadow-ban or unban a user

Args:
user_id (string): The user to be baned/unbanned
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: banned

synadm/api.py Outdated

Args:
user_id (string): The user to be baned/unbanned
unban (boolean): Unban the specified user
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

End "sentences" with dot.

Generally, it is more appropriate to ban or kick abusive users.
"""
user_ban = helper.api.user_shadow_ban(user_id, unban)
helper.output(user_ban)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API seems to always return empty dict {} when no error occured. If you want but not strictly required you could prettify that for human mode. Something like this: https://github.com/Ascurius/synadm/blob/master/synadm/cli/user.py#L127-L134


A shadow-banned user will not receive any notification, but still will be
unable to contact anyone on the server. Use this as a tool of last resort since it
may lead to confusing or broken behaviour for the client.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the lines 79 characters max. Don't know what editor you are using but with something vim'ish the quickest way would be marking the lines and pressing gq

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there is a redundant space after client.

unable to contact anyone on the server. Use this as a tool of last resort since it
may lead to confusing or broken behaviour for the client.

Generally, it is more appropriate to ban or kick abusive users.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some redundant spaces.

@Ascurius
Copy link
Collaborator Author

Ascurius commented Mar 2, 2022

Sorry for my late response. I modified the section you mentioned according to your requirements. Besides, I have added some additional body to the shadow-ban command for the human mode. Please let me know if anything else needs to be changed.

@JOJ0 JOJ0 merged commit d3e2521 into JOJ0:master Mar 4, 2022
@JOJ0
Copy link
Owner

JOJ0 commented Mar 4, 2022

No worries, all good, thanks a lot for the changes. Merged and happy synadm got a nice new feature. Many thanks!

@JOJ0
Copy link
Owner

JOJ0 commented Mar 4, 2022

BTW I'd like to contact you because of something else and invite you to synadm:peek-a-boo.at

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.

2 participants