about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-05-02 17:41:34 +0200
committerGitHub <noreply@github.com>2022-05-02 17:41:34 +0200
commitbc19c083cef6f66d28528d79548cf692fa8a2ca6 (patch)
treed67f398c97adb6e5276ab3c38b3e483d7f433a2d /lib
parent71d02ffcf3a79dfc1c413dcc7ff45c77ce9cb94c (diff)
Add ability to set approval-based registration through tootctl (#18248)
Fixes #18235

Add `tootctl settings registrations approved` with
optional `--require-reason` switch.
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/settings_cli.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/mastodon/settings_cli.rb b/lib/mastodon/settings_cli.rb
index 061650a80..488c655de 100644
--- a/lib/mastodon/settings_cli.rb
+++ b/lib/mastodon/settings_cli.rb
@@ -16,6 +16,20 @@ module Mastodon
       say('OK', :green)
     end
 
+    desc 'approved', 'Open approval-based registrations'
+    option :require_reason, type: :boolean, aliases: [:require_invite_text]
+    long_desc <<~LONG_DESC
+      Set registrations to require review from staff.
+
+      With --require-reason, require users to enter a reason when registering,
+      otherwise this field is optional.
+    LONG_DESC
+    def approved
+      Setting.registrations_mode = 'approved'
+      Setting.require_invite_text = options[:require_reason] unless options[:require_reason].nil?
+      say('OK', :green)
+    end
+
     desc 'close', 'Close registrations'
     def close
       Setting.registrations_mode = 'none'