Auto-promote DanbooruBot to Mod. Auto-create DanbooruBot if it doesn't exist.

This commit is contained in:
evazion
2017-12-15 14:51:24 -06:00
parent b48211cd4a
commit e2eb45a5a3
8 changed files with 21 additions and 9 deletions

View File

@@ -316,7 +316,7 @@ class User < ApplicationRecord
module ClassMethods
def system
Danbooru.config.system_user
User.find_by!(name: Danbooru.config.system_user)
end
def level_hash
@@ -366,7 +366,7 @@ class User < ApplicationRecord
def promote_to_admin_if_first_user
return if Rails.env.test?
if User.count == 0
if User.admins.count == 0
self.level = Levels::ADMIN
self.can_approve_posts = true
self.can_upload_free = true