Skip to content

Commit 4d4a1a8

Browse files
Gargronhiyuki2578
authored andcommitted
Fix accounts created through tootctl not being always pre-approved (mastodon#10684)
Add `--approve` option to `tootctl accounts modify`
1 parent f9543af commit 4d4a1a8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/mastodon/accounts_cli.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def rotate(username = nil)
7373
def create(username)
7474
account = Account.new(username: username)
7575
password = SecureRandom.hex
76-
user = User.new(email: options[:email], password: password, agreement: true, admin: options[:role] == 'admin', moderator: options[:role] == 'moderator', confirmed_at: options[:confirmed] ? Time.now.utc : nil)
76+
user = User.new(email: options[:email], password: password, agreement: true, approved: true, admin: options[:role] == 'admin', moderator: options[:role] == 'moderator', confirmed_at: options[:confirmed] ? Time.now.utc : nil)
7777

7878
if options[:reattach]
7979
account = Account.find_local(username) || Account.new(username: username)
@@ -115,6 +115,7 @@ def create(username)
115115
option :enable, type: :boolean
116116
option :disable, type: :boolean
117117
option :disable_2fa, type: :boolean
118+
option :approve, type: :boolean
118119
desc 'modify USERNAME', 'Modify a user'
119120
long_desc <<-LONG_DESC
120121
Modify a user account.
@@ -128,6 +129,9 @@ def create(username)
128129
With the --disable option, lock the user out of their account. The
129130
--enable option is the opposite.
130131
132+
With the --approve option, the account will be approved, if it was
133+
previously not due to not having open registrations.
134+
131135
With the --disable-2fa option, the two-factor authentication
132136
requirement for the user can be removed.
133137
LONG_DESC
@@ -147,6 +151,7 @@ def modify(username)
147151
user.email = options[:email] if options[:email]
148152
user.disabled = false if options[:enable]
149153
user.disabled = true if options[:disable]
154+
user.approved = true if options[:approve]
150155
user.otp_required_for_login = false if options[:disable_2fa]
151156
user.confirm if options[:confirm]
152157

0 commit comments

Comments
 (0)