sync
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
Danbooru::Application.routes.draw do
|
||||
namespace :admin do
|
||||
resources :users
|
||||
resources :posts do
|
||||
collection do
|
||||
get :mass_edit
|
||||
put :mass_update
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
resources :advertisements
|
||||
resources :advertisement_hits
|
||||
resources :artists do
|
||||
member do
|
||||
put :revert
|
||||
@@ -38,7 +44,11 @@ Danbooru::Application.routes.draw do
|
||||
resources :reports
|
||||
resources :sessions
|
||||
resources :tags
|
||||
resources :tag_aliases
|
||||
resources :tag_aliases do
|
||||
member do
|
||||
delete :cache
|
||||
end
|
||||
end
|
||||
resources :tag_implications
|
||||
resources :tag_subscriptions
|
||||
resources :unapprovals
|
||||
@@ -47,6 +57,7 @@ Danbooru::Application.routes.draw do
|
||||
resources :user_feedback
|
||||
resources :wiki_pages do
|
||||
member do
|
||||
get :show, :id => /.+/
|
||||
put :revert
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user