]> cat aescling's git repositories - mastodon.git/commitdiff
Add tasks for open/close registration (#1823)
authorAndrew <andrewLchronister@gmail.com>
Sat, 15 Apr 2017 11:17:07 +0000 (04:17 -0700)
committerEugen <eugen@zeonfederated.com>
Sat, 15 Apr 2017 11:17:07 +0000 (13:17 +0200)
* Add tasks for open/close registration

* Code climate style fix

* Use true instead of string 'true'

lib/tasks/mastodon.rake

index 4761b2919c6182612408c0f79e4b028f45b155c9..15b423745595626f1cc56cd9c6c4c717ef2d0be3 100644 (file)
@@ -82,6 +82,22 @@ namespace :mastodon do
     end
   end
 
+  namespace :settings do
+    desc 'Open registrations on this instance'
+    task open_registrations: :environment do
+      setting = Setting.where(var: 'open_registrations').first
+      setting.value = true
+      setting.save
+    end
+
+    desc 'Close registrations on this instance'
+    task close_registrations: :environment do
+      setting = Setting.where(var: 'open_registrations').first
+      setting.value = false
+      setting.save
+    end
+  end
+
   namespace :maintenance do
     desc 'Update counter caches'
     task update_counter_caches: :environment do