This commit is contained in:
albert
2010-10-08 18:42:26 -04:00
parent 6bc469b05d
commit f051e04550
88 changed files with 2865 additions and 699 deletions

View File

@@ -127,13 +127,22 @@ module Danbooru
Socket.gethostname
end
# Names of other Danbooru servers which serve out of the same common database.
# Names of all Danbooru servers which serve out of the same common database.
# Used in conjunction with load balancing to distribute files from one server to
# the others. This should match whatever gethostname returns on the other servers.
def other_server_hosts
def all_server_hosts
[]
end
# Names of other Danbooru servers.
def other_server_hosts
all_server_hosts.reject {|x| x == server_host}
end
def remote_server_login
"albert"
end
# Returns a hash mapping various tag categories to a numerical value.
# Be sure to update the reverse_tag_category_mapping also.
def tag_category_mapping
@@ -191,5 +200,25 @@ module Danbooru
def posts_per_page
20
end
def is_post_restricted?(post)
post.has_tag?("loli") || post.has_tag?("shota")
end
def is_user_restricted?(user)
!user.is_privileged? || user.name == "ppayne"
end
def can_user_see_post?(user, post)
if is_user_restricted?(user) && is_post_restricted?(post)
false
else
true
end
end
def select_posts_visible_to_user(user, posts)
posts.select {|x| !is_user_restricted?(user) || !is_post_restricted?(x)}
end
end
end