[chore] Remove unused admin account suspend action (#1047)

* [docs] clarify that admin account commands are for local accounts

* [chore] remove confusing unused `admin account suspend` command
This commit is contained in:
tobi 2022-11-14 16:51:53 +01:00 committed by GitHub
parent e2e2bedd42
commit 8c20ccd9a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 59 deletions

View file

@ -232,12 +232,6 @@ var Disable action.GTSAction = func(ctx context.Context) error {
return dbConn.Stop(ctx) return dbConn.Stop(ctx)
} }
// Suspend suspends the target account, cleanly removing all of its media, followers, following, likes, statuses, etc.
var Suspend action.GTSAction = func(ctx context.Context) error {
// TODO
return nil
}
// Password sets the password of target account. // Password sets the password of target account.
var Password action.GTSAction = func(ctx context.Context) error { var Password action.GTSAction = func(ctx context.Context) error {
dbConn, err := bundb.NewBunDBService(ctx) dbConn, err := bundb.NewBunDBService(ctx)

View file

@ -37,13 +37,13 @@ func adminCommands() *cobra.Command {
adminAccountCmd := &cobra.Command{ adminAccountCmd := &cobra.Command{
Use: "account", Use: "account",
Short: "admin commands related to accounts", Short: "admin commands related to local (this instance) accounts",
} }
config.AddAdminAccount(adminAccountCmd) config.AddAdminAccount(adminAccountCmd)
adminAccountCreateCmd := &cobra.Command{ adminAccountCreateCmd := &cobra.Command{
Use: "create", Use: "create",
Short: "create a new account", Short: "create a new local account",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd}) return preRun(preRunArgs{cmd: cmd})
}, },
@ -56,7 +56,7 @@ func adminCommands() *cobra.Command {
adminAccountConfirmCmd := &cobra.Command{ adminAccountConfirmCmd := &cobra.Command{
Use: "confirm", Use: "confirm",
Short: "confirm an existing account manually, thereby skipping email confirmation", Short: "confirm an existing local account manually, thereby skipping email confirmation",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd}) return preRun(preRunArgs{cmd: cmd})
}, },
@ -69,7 +69,7 @@ func adminCommands() *cobra.Command {
adminAccountPromoteCmd := &cobra.Command{ adminAccountPromoteCmd := &cobra.Command{
Use: "promote", Use: "promote",
Short: "promote an account to admin", Short: "promote a local account to admin",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd}) return preRun(preRunArgs{cmd: cmd})
}, },
@ -82,7 +82,7 @@ func adminCommands() *cobra.Command {
adminAccountDemoteCmd := &cobra.Command{ adminAccountDemoteCmd := &cobra.Command{
Use: "demote", Use: "demote",
Short: "demote an account from admin to normal user", Short: "demote a local account from admin to normal user",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd}) return preRun(preRunArgs{cmd: cmd})
}, },
@ -95,7 +95,7 @@ func adminCommands() *cobra.Command {
adminAccountDisableCmd := &cobra.Command{ adminAccountDisableCmd := &cobra.Command{
Use: "disable", Use: "disable",
Short: "prevent an account from signing in or posting etc, but don't delete anything", Short: "prevent a local account from signing in or posting etc, but don't delete anything",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd}) return preRun(preRunArgs{cmd: cmd})
}, },
@ -106,22 +106,9 @@ func adminCommands() *cobra.Command {
config.AddAdminAccount(adminAccountDisableCmd) config.AddAdminAccount(adminAccountDisableCmd)
adminAccountCmd.AddCommand(adminAccountDisableCmd) adminAccountCmd.AddCommand(adminAccountDisableCmd)
adminAccountSuspendCmd := &cobra.Command{
Use: "suspend",
Short: "completely remove an account and all of its posts, media, etc",
PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd})
},
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), account.Suspend)
},
}
config.AddAdminAccount(adminAccountSuspendCmd)
adminAccountCmd.AddCommand(adminAccountSuspendCmd)
adminAccountPasswordCmd := &cobra.Command{ adminAccountPasswordCmd := &cobra.Command{
Use: "password", Use: "password",
Short: "set a new password for the given account", Short: "set a new password for the given local account",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(preRunArgs{cmd: cmd}) return preRun(preRunArgs{cmd: cmd})
}, },

View file

@ -44,7 +44,7 @@ This command can be used to create a new account on your instance.
`gotosocial admin account create --help`: `gotosocial admin account create --help`:
```text ```text
create a new account create a new local account
Usage: Usage:
gotosocial admin account create [flags] gotosocial admin account create [flags]
@ -73,7 +73,7 @@ This command can be used to confirm a user+account on your instance, allowing th
`gotosocial admin account confirm --help`: `gotosocial admin account confirm --help`:
```text ```text
confirm an existing account manually, thereby skipping email confirmation confirm an existing local account manually, thereby skipping email confirmation
Usage: Usage:
gotosocial admin account confirm [flags] gotosocial admin account confirm [flags]
@ -96,7 +96,7 @@ This command can be used to promote a user to admin.
`gotosocial admin account promote --help`: `gotosocial admin account promote --help`:
```text ```text
promote an account to admin promote a local account to admin
Usage: Usage:
gotosocial admin account promote [flags] gotosocial admin account promote [flags]
@ -119,7 +119,7 @@ This command can be used to demote a user from admin to normal user.
`gotosocial admin account demote --help`: `gotosocial admin account demote --help`:
```text ```text
demote an account from admin to normal user demote a local account from admin to normal user
Usage: Usage:
gotosocial admin account demote [flags] gotosocial admin account demote [flags]
@ -137,12 +137,12 @@ gotosocial admin account demote --username some_username --config-path config.ya
### gotosocial admin account disable ### gotosocial admin account disable
This command can be used to disable an account: prevent it from signing in or doing anything, without deleting data. This command can be used to disable an account on your instance: prevent it from signing in or doing anything, without deleting data.
`gotosocial admin account disable --help`: `gotosocial admin account disable --help`:
```text ```text
prevent an account from signing in or posting etc, but don't delete anything prevent a local account from signing in or posting etc, but don't delete anything
Usage: Usage:
gotosocial admin account disable [flags] gotosocial admin account disable [flags]
@ -158,39 +158,14 @@ Example:
gotosocial admin account disable --username some_username --config-path config.yaml gotosocial admin account disable --username some_username --config-path config.yaml
``` ```
### gotosocial admin account suspend
This command can be used to completely remove an account's media/posts/etc and prevent it from logging in.
In other words, this 'deletes' the account (without actually removing the account entry, meaning the username cannot be used again).
`gotosocial admin account suspend --help`:
```text
completely remove an account and all of its posts, media, etc
Usage:
gotosocial admin account suspend [flags]
Flags:
-h, --help help for suspend
--username string the username to create/delete/etc
```
Example:
```bash
gotosocial admin account suspend --username some_username --config-path config.yaml
```
### gotosocial admin account password ### gotosocial admin account password
This command can be used to set a new password on the given account. This command can be used to set a new password on the given local account.
`gotosocial admin account password --help`: `gotosocial admin account password --help`:
```text ```text
set a new password for the given account set a new password for the given local account
Usage: Usage:
gotosocial admin account password [flags] gotosocial admin account password [flags]