rename references of privileged to gold

This commit is contained in:
r888888888
2013-04-28 00:04:52 -07:00
parent 6a00c6330f
commit d5f575159f
112 changed files with 165 additions and 165 deletions

View File

@@ -11,7 +11,7 @@ class Artist < ActiveRecord::Base
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name"
accepts_nested_attributes_for :wiki_page
attr_accessible :body, :name, :url_string, :other_names, :other_names_comma, :group_name, :wiki_page_attributes, :notes, :as => [:member, :privileged, :builder, :platinum, :contributor, :janitor, :moderator, :default, :admin]
attr_accessible :body, :name, :url_string, :other_names, :other_names_comma, :group_name, :wiki_page_attributes, :notes, :as => [:member, :gold, :builder, :platinum, :contributor, :janitor, :moderator, :default, :admin]
attr_accessible :is_active, :as => [:builder, :contributor, :janitor, :moderator, :default, :admin]
attr_accessible :is_banned, :as => :admin
@@ -116,8 +116,8 @@ class Artist < ActiveRecord::Base
Artist.new.tap do |artist|
if params[:name]
artist.name = params[:name]
if CurrentUser.user.is_privileged?
# below privileged users are limited to two tags
if CurrentUser.user.is_gold?
# below gold users are limited to two tags
post = Post.tag_match("source:http #{artist.name} status:any").first
else
post = Post.tag_match("source:http #{artist.name}").first

View File

@@ -11,7 +11,7 @@ class Favorite < ActiveRecord::Base
return if Favorite.for_user(user.id).exists?(:user_id => user.id, :post_id => post.id)
Favorite.create(:user_id => user.id, :post_id => post.id)
Post.update_all("fav_count = fav_count + 1", "id = #{post.id}")
Post.update_all("score = score + 1", "id = #{post.id}") if user.is_privileged?
Post.update_all("score = score + 1", "id = #{post.id}") if user.is_gold?
post.append_user_to_fav_string(user.id)
user.add_favorite!(post)
user.increment!(:favorite_count)
@@ -22,7 +22,7 @@ class Favorite < ActiveRecord::Base
return unless Favorite.for_user(user.id).exists?(:user_id => user.id, :post_id => post.id)
Favorite.destroy_all(:user_id => user.id, :post_id => post.id)
Post.update_all("fav_count = fav_count - 1", "id = #{post.id}")
Post.update_all("score = score - 1", "id = #{post.id}") if user.is_privileged?
Post.update_all("score = score - 1", "id = #{post.id}") if user.is_gold?
post.delete_user_from_fav_string(user.id)
user.remove_favorite!(post)
user.decrement!(:favorite_count)

View File

@@ -1,5 +1,5 @@
class ForumPost < ActiveRecord::Base
attr_accessible :body, :topic_id, :as => [:member, :builder, :janitor, :privileged, :platinum, :contributor, :admin, :moderator, :default]
attr_accessible :body, :topic_id, :as => [:member, :builder, :janitor, :gold, :platinum, :contributor, :admin, :moderator, :default]
attr_accessible :is_locked, :is_sticky, :is_deleted, :as => [:admin, :moderator, :janitor]
belongs_to :creator, :class_name => "User"
belongs_to :updater, :class_name => "User"

View File

@@ -1,5 +1,5 @@
class ForumTopic < ActiveRecord::Base
attr_accessible :title, :original_post_attributes, :as => [:member, :builder, :privileged, :platinum, :contributor, :janitor, :moderator, :admin, :default]
attr_accessible :title, :original_post_attributes, :as => [:member, :builder, :gold, :platinum, :contributor, :janitor, :moderator, :admin, :default]
attr_accessible :is_sticky, :is_locked, :is_deleted, :as => [:janitor, :admin, :moderator]
belongs_to :creator, :class_name => "User"
belongs_to :updater, :class_name => "User"

View File

@@ -12,7 +12,7 @@ class Pool < ActiveRecord::Base
before_validation :initialize_creator, :on => :create
after_save :create_version
before_destroy :create_mod_action_for_destroy
attr_accessible :name, :description, :post_ids, :post_id_array, :post_count, :is_active, :as => [:member, :privileged, :platinum, :contributor, :janitor, :moderator, :admin, :default]
attr_accessible :name, :description, :post_ids, :post_id_array, :post_count, :is_active, :as => [:member, :gold, :platinum, :contributor, :janitor, :moderator, :admin, :default]
attr_accessible :is_deleted, :as => [:janitor, :moderator, :admin]
module SearchMethods

View File

@@ -31,7 +31,7 @@ class Post < ActiveRecord::Base
has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy
validates_uniqueness_of :md5
validates_presence_of :parent, :if => lambda {|rec| !rec.parent_id.nil?}
attr_accessible :source, :rating, :tag_string, :old_tag_string, :last_noted_at, :parent_id, :as => [:member, :builder, :privileged, :platinum, :contributor, :janitor, :moderator, :admin, :default]
attr_accessible :source, :rating, :tag_string, :old_tag_string, :last_noted_at, :parent_id, :as => [:member, :builder, :gold, :platinum, :contributor, :janitor, :moderator, :admin, :default]
attr_accessible :is_rating_locked, :is_note_locked, :as => [:builder, :contributor, :janitor, :moderator, :admin]
attr_accessible :is_status_locked, :as => [:admin]

View File

@@ -130,7 +130,7 @@ class TagSubscription < ActiveRecord::Base
def self.process_all
CurrentUser.scoped(User.admins.first, "127.0.0.1") do
find_each do |tag_subscription|
if $job_task_daemon_active != false && tag_subscription.creator.is_privileged? && tag_subscription.is_active?
if $job_task_daemon_active != false && tag_subscription.creator.is_gold? && tag_subscription.is_active?
begin
tag_subscription.process
tag_subscription.save

View File

@@ -7,7 +7,7 @@ class User < ActiveRecord::Base
module Levels
BLOCKED = 10
MEMBER = 20
PRIVILEGED = 30
GOLD = 30
PLATINUM = 31
BUILDER = 32
CONTRIBUTOR = 33
@@ -17,7 +17,7 @@ class User < ActiveRecord::Base
end
attr_accessor :password, :old_password
attr_accessible :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr, :time_zone, :default_image_size, :enable_sequential_post_navigation, :per_page, :hide_deleted_posts, :style_usernames, :as => [:moderator, :janitor, :contributor, :privileged, :member, :anonymous, :default, :builder, :admin]
attr_accessible :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr, :time_zone, :default_image_size, :enable_sequential_post_navigation, :per_page, :hide_deleted_posts, :style_usernames, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin]
attr_accessible :level, :as => :admin
validates_length_of :name, :within => 2..100, :on => :create
validates_format_of :name, :with => /\A[^\s:]+\Z/, :on => :create, :message => "cannot have whitespace or colons"
@@ -229,7 +229,7 @@ class User < ActiveRecord::Base
def level_hash
return {
"Member" => Levels::MEMBER,
"Gold" => Levels::PRIVILEGED,
"Gold" => Levels::GOLD,
"Platinum" => Levels::PLATINUM,
"Builder" => Levels::BUILDER,
"Contributor" => Levels::CONTRIBUTOR,
@@ -255,8 +255,8 @@ class User < ActiveRecord::Base
when Levels::MEMBER
:member
when Levels::PRIVILEGED
:privileged
when Levels::GOLD
:gold
when Levels::BUILDER
:builder
@@ -286,7 +286,7 @@ class User < ActiveRecord::Base
when Levels::BUILDER
"Builder"
when Levels::PRIVILEGED
when Levels::GOLD
"Gold"
when Levels::PLATINUM
@@ -321,8 +321,8 @@ class User < ActiveRecord::Base
level >= Levels::BUILDER
end
def is_privileged?
level >= Levels::PRIVILEGED
def is_gold?
level >= Levels::GOLD
end
def is_platinum?
@@ -356,7 +356,7 @@ class User < ActiveRecord::Base
end
def set_per_page
if per_page.nil? || !is_privileged?
if per_page.nil? || !is_gold?
self.per_page = Danbooru.config.posts_per_page
end
@@ -398,7 +398,7 @@ class User < ActiveRecord::Base
module ForumMethods
def has_forum_been_updated?
return false unless is_privileged?
return false unless is_gold?
newest_topic = ForumTopic.order("updated_at desc").first
return false if newest_topic.nil?
return true if last_forum_read_at.nil?
@@ -426,7 +426,7 @@ class User < ActiveRecord::Base
end
def can_comment?
if is_privileged?
if is_gold?
true
else
created_at <= Danbooru.config.member_comment_time_threshold
@@ -434,7 +434,7 @@ class User < ActiveRecord::Base
end
def is_comment_limited?
if is_privileged?
if is_gold?
false
else
Comment.where("creator_id = ? and created_at > ?", id, 1.hour.ago).count >= Danbooru.config.member_comment_limit
@@ -470,7 +470,7 @@ class User < ActiveRecord::Base
def tag_query_limit
if is_platinum?
Danbooru.config.base_tag_query_limit * 2
elsif is_privileged?
elsif is_gold?
Danbooru.config.base_tag_query_limit
else
2
@@ -480,7 +480,7 @@ class User < ActiveRecord::Base
def favorite_limit
if is_platinum?
nil
elsif is_privileged?
elsif is_gold?
20_000
else
10_000
@@ -490,7 +490,7 @@ class User < ActiveRecord::Base
def api_hourly_limit
if is_platinum?
20_000
elsif is_privileged?
elsif is_gold?
10_000
else
3_000
@@ -500,7 +500,7 @@ class User < ActiveRecord::Base
def statement_timeout
if is_platinum?
9_000
elsif is_privileged?
elsif is_gold?
6_000
else
3_000

View File

@@ -5,7 +5,7 @@ class UserFeedback < ActiveRecord::Base
before_validation :initialize_creator, :on => :create
attr_accessible :body, :user_id, :category, :user_name
validates_presence_of :user, :creator, :body, :category
validate :creator_is_privileged
validate :creator_is_gold
validate :user_is_not_creator
after_create :create_dmail
@@ -73,9 +73,9 @@ class UserFeedback < ActiveRecord::Base
Dmail.create_split(:to_id => user_id, :title => "Your user record has been updated", :body => body)
end
def creator_is_privileged
if !creator.is_privileged?
errors[:creator] << "must be privileged"
def creator_is_gold
if !creator.is_gold?
errors[:creator] << "must be gold"
return false
else
return true