Add tasks for open/close registration (#1823)
* Add tasks for open/close registration * Code climate style fix * Use true instead of string 'true'
This commit is contained in:
		
							parent
							
								
									f9d7ec8971
								
							
						
					
					
						commit
						e28a5aab08
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
					@ -82,6 +82,22 @@ namespace :mastodon do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  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
 | 
					  namespace :maintenance do
 | 
				
			||||||
    desc 'Update counter caches'
 | 
					    desc 'Update counter caches'
 | 
				
			||||||
    task update_counter_caches: :environment do
 | 
					    task update_counter_caches: :environment do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue