Merge pull request #2701 from evazion/feat/customize-new-user

Make starting user level and default settings configurable.
This commit is contained in:
Albert Yi
2016-10-05 12:46:12 -07:00
committed by GitHub
2 changed files with 19 additions and 8 deletions

View File

@@ -64,6 +64,7 @@ class User < ActiveRecord::Base
after_save :update_cache
after_update :update_remote_cache
before_create :promote_to_admin_if_first_user
before_create :customize_new_user
#after_create :notify_sock_puppets
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
has_many :posts, :foreign_key => "uploader_id"
@@ -311,6 +312,10 @@ class User < ActiveRecord::Base
end
end
def customize_new_user
Danbooru.config.customize_new_user(self)
end
def role
case level
when Levels::MEMBER

View File

@@ -49,14 +49,20 @@ module Danbooru
"choujin-steiner"
end
# Set to true to give all new users gold access.
def start_as_gold?
false
end
# Set to true to give all new users contributor access.
def start_as_contributor?
false
# Set the default level, permissions, and other settings for new users here.
def customize_new_user(user)
# user.level = User::Levels::MEMBER
# user.can_approve_posts = false
# user.can_upload_free = false
# user.is_super_voter = false
#
# user.base_upload_limit = 10
# user.comment_threshold = -1
# user.blacklisted_tags = ["spoilers", "guro", "scat", "furry -rating:s"].join("\n")
# user.default_image_size = "large"
# user.per_page = 20
# user.disable_tagged_filenames = false
true
end
# What method to use to store images.