about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-27 14:31:10 +0200
committerGitHub <noreply@github.com>2022-10-27 14:31:10 +0200
commitd7595adbf4bc1677aee555baca46902f4dee1ae4 (patch)
tree3bc2f3de0bf3a1498797d1e03fe560ce8d2d854f
parent3e18e05330ac8c1101845db650d7cd62b0fa8260 (diff)
Add `--remove-role` option to `tootctl accounts modify` (#19477)
Fix #19152
-rw-r--r--lib/mastodon/accounts_cli.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb
index 558f4d3c4..c8a8448ed 100644
--- a/lib/mastodon/accounts_cli.rb
+++ b/lib/mastodon/accounts_cli.rb
@@ -126,6 +126,7 @@ module Mastodon
     end
 
     option :role
+    option :remove_role, type: :boolean
     option :email
     option :confirm, type: :boolean
     option :enable, type: :boolean
@@ -137,7 +138,8 @@ module Mastodon
     long_desc <<-LONG_DESC
       Modify a user account.
 
-      With the --role option, update the user's role.
+      With the --role option, update the user's role. To remove the user's
+      role, i.e. demote to normal user, use --remove-role.
 
       With the --email option, update the user's e-mail address. With
       the --confirm option, mark the user's e-mail as confirmed.
@@ -171,6 +173,8 @@ module Mastodon
         end
 
         user.role_id = role.id
+      elsif options[:remove_role]
+        user.role_id = nil
       end
 
       password = SecureRandom.hex if options[:reset_password]