]> cat aescling's git repositories - mastodon.git/commitdiff
Add ability to set approval-based registration through tootctl (#18248)
authorClaire <claire.github-309c@sitedethib.com>
Mon, 2 May 2022 15:41:34 +0000 (17:41 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Thu, 5 May 2022 17:49:13 +0000 (13:49 -0400)
Fixes #18235

Add `tootctl settings registrations approved` with
optional `--require-reason` switch.

lib/mastodon/settings_cli.rb

index 061650a80bb6f7a6203c5ac1f03fc646dd99e535..488c655deedd7ba94e44eb00dc6822c229787121 100644 (file)
@@ -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'