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

Add user silencing to CLI #360

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Conversation

mrvdb
Copy link
Collaborator

@mrvdb mrvdb commented Aug 4, 2020

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.

@mrvdb mrvdb requested a review from thebaer August 27, 2020 07:30
Copy link
Member

@thebaer thebaer left a 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",
Copy link
Member

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"):
Copy link
Member

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)
Copy link
Member

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.

@thebaer thebaer added this to the 0.13 milestone Aug 31, 2020
@mrvdb
Copy link
Collaborator Author

mrvdb commented Sep 1, 2020

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.

@mrvdb mrvdb marked this pull request as draft September 1, 2020 08:23
@thebaer
Copy link
Member

thebaer commented Oct 3, 2020

No problem, @mrvdb. Any progress on this?

@mrvdb
Copy link
Collaborator Author

mrvdb commented Oct 3, 2020

Haven't been revisiting it yet.

@thebaer
Copy link
Member

thebaer commented Apr 19, 2021

@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.

@mrvdb
Copy link
Collaborator Author

mrvdb commented Apr 21, 2021

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.

@thebaer thebaer modified the milestones: 0.13, 1.0 Apr 21, 2021
@thebaer
Copy link
Member

thebaer commented Apr 21, 2021

No problem, thanks for letting me know!

@thebaer thebaer removed this from the 0.14 milestone Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants