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
Add user silencing to CLI #360
base: develop
Are you sure you want to change the base?
Conversation
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.
Thanks for submitting this! I think it'd make a great addition. Just a couple changes needed and we can merge this.
@@ -85,6 +85,11 @@ func main() { | |||
Usage: "Delete a user with the given username", | |||
Hidden: true, | |||
}, | |||
&cli.StringFlag{ | |||
Name: "silence-user", |
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.
We kept old flags in here only for backwards compatibility. Ideally we'd move away from this older style, so we don't need to add new commands here.
@@ -152,6 +157,8 @@ func legacyActions(c *cli.Context) error { | |||
return writefreely.CreateUser(app, username, password, false) | |||
case c.IsSet("delete-user"): | |||
return writefreely.DoDeleteAccount(app, c.String("delete-user")) | |||
case c.IsSet("silence-user"): |
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.
Same here -- no need to check for this flag.
} | ||
|
||
log.Info("Silencing...") | ||
err = apper.App().db.SilenceAccount(userID) |
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 think ideally we should use the existing datastore.SetUserStatus()
method instead of creating a new one here, to keep things maintainable.
Thanks for the review Matt. Agreed on all points. It's hard to deduce the direction of code from existing stuff, so I took the lazy route and just did a 'copy-pasta' first to get it to work and allow me to manage some abuse on qua.name. I'll be returning to this PR after returning from travel. I'll set state to WIP after I find out where to click. |
No problem, @mrvdb. Any progress on this? |
Haven't been revisiting it yet. |
@mrvdb I'm hoping to get the next release out within the next week or two, so if you can make those changes before then, we'll include them in v0.13! Otherwise we can include it in the following release. |
Sorry, I won't have the opportunity in the foreseeable future to spent time on this. Feel free to remove or complete as you see fit. |
No problem, thanks for letting me know! |
Add user silencing to CLI
Quick implementation. Ideally unsilence should be there as well and for scriptability a 'no-confirm' flag of some sort would be nice.