change privileged accounts to gold accounts, add platinum accounts, add favorite and tag query limiting based on level
This commit is contained in:
@@ -210,7 +210,7 @@ class Tag < ActiveRecord::Base
|
||||
output[:include] << tag[1..-1]
|
||||
|
||||
elsif tag =~ /\*/
|
||||
matches = Tag.name_matches(tag).all(:select => "name", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC").map(&:name)
|
||||
matches = Tag.name_matches(tag).all(:select => "name", :limit => CurrentUser.tag_query_limit, :order => "post_count DESC").map(&:name)
|
||||
matches = ["~no_matches~"] if matches.empty?
|
||||
output[:include] += matches
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ class User < ActiveRecord::Base
|
||||
BLOCKED = 10
|
||||
MEMBER = 20
|
||||
PRIVILEGED = 30
|
||||
PLATINUM = 31
|
||||
BUILDER = 32
|
||||
CONTRIBUTOR = 33
|
||||
JANITOR = 35
|
||||
@@ -262,7 +263,10 @@ class User < ActiveRecord::Base
|
||||
"Builder"
|
||||
|
||||
when Levels::PRIVILEGED
|
||||
"Privileged"
|
||||
"Gold"
|
||||
|
||||
when Levels::PLATINUM
|
||||
"Platinum"
|
||||
|
||||
when Levels::CONTRIBUTOR
|
||||
"Contributor"
|
||||
@@ -294,6 +298,10 @@ class User < ActiveRecord::Base
|
||||
level >= Levels::PRIVILEGED
|
||||
end
|
||||
|
||||
def is_platinum?
|
||||
level >= Levels::PLATINUM
|
||||
end
|
||||
|
||||
def is_contributor?
|
||||
level >= Levels::CONTRIBUTOR
|
||||
end
|
||||
@@ -403,6 +411,26 @@ class User < ActiveRecord::Base
|
||||
|
||||
limit
|
||||
end
|
||||
|
||||
def tag_query_limit
|
||||
if is_privileged?
|
||||
Danbooru.config.tag_query_limit
|
||||
elsif is_platinum?
|
||||
Danbooru.config.tag_query_limit * 2
|
||||
else
|
||||
2
|
||||
end
|
||||
end
|
||||
|
||||
def favorite_limit
|
||||
if is_privileged?
|
||||
5_000
|
||||
elsif is_platinum?
|
||||
nil
|
||||
else
|
||||
1_000
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ApiMethods
|
||||
|
||||
Reference in New Issue
Block a user