diff --git a/app/controllers/post_versions_controller.rb b/app/controllers/post_versions_controller.rb index 93dfc5558..af484f500 100644 --- a/app/controllers/post_versions_controller.rb +++ b/app/controllers/post_versions_controller.rb @@ -17,7 +17,7 @@ class PostVersionsController < ApplicationController def undo @post_version = PostVersion.find(params[:id]) - if Danbooru.config.can_user_see_post?(CurrentUser.user, @post_version.post) + if @post_version.post.visible? @post_version.undo! end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 5fa965fd1..f5b5d1e7f 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -46,7 +46,7 @@ class PostsController < ApplicationController def update @post = Post.find(params[:id]) - if Danbooru.config.can_user_see_post?(CurrentUser.user, @post) + if @post.visible? @post.update_attributes(params[:post], :as => CurrentUser.role) end @@ -76,7 +76,7 @@ class PostsController < ApplicationController @post = Post.find(params[:id]) @version = PostVersion.find(params[:version_id]) - if Danbooru.config.can_user_see_post?(CurrentUser.user, @post) + if @post.visible? @post.revert_to!(@version) end diff --git a/app/models/post.rb b/app/models/post.rb index e1b0a3165..c127ce6a0 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1094,7 +1094,7 @@ class Post < ActiveRecord::Base module ApiMethods def hidden_attributes list = [:tag_index] - if !Danbooru.config.can_user_see_post?(CurrentUser.user, self) + if !visible? list += [:md5, :file_ext] end super + list @@ -1102,7 +1102,7 @@ class Post < ActiveRecord::Base def method_attributes list = [:uploader_name, :has_large, :tag_string_artist, :tag_string_character, :tag_string_copyright, :tag_string_general] - if Danbooru.config.can_user_see_post?(CurrentUser.user, self) + if visible? list += [:file_url, :large_file_url, :preview_file_url] end list @@ -1147,7 +1147,7 @@ class Post < ActiveRecord::Base "id" => id } - if Danbooru.config.can_user_see_post?(CurrentUser.user, self) + if visible? hash["file_url"] = file_url hash["preview_url"] = preview_file_url hash["md5"] = md5 diff --git a/app/views/comments/index_by_post.html.erb b/app/views/comments/index_by_post.html.erb index 73db2afe3..16ab979dd 100644 --- a/app/views/comments/index_by_post.html.erb +++ b/app/views/comments/index_by_post.html.erb @@ -11,7 +11,7 @@ <%= render "post_sets/blank" %> <% end %> - <% @posts.select {|x| Danbooru.config.can_user_see_post?(CurrentUser.user, x)}.each do |post| %> + <% @posts.select {|x| x.visible?}.each do |post| %>
>
<% if post.visible? %> diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_listing.html.erb index c6b2099ae..5c96c2168 100644 --- a/app/views/post_versions/_listing.html.erb +++ b/app/views/post_versions/_listing.html.erb @@ -36,7 +36,7 @@ <%= post_version_diff(post_version) %> <% if CurrentUser.is_member? %> - <% if Danbooru.config.can_user_see_post?(CurrentUser.user, post_version.post) %> + <% if post_version.post.visible? %> <% if post_version.id != post_version.post.versions.first.id %> <%= link_to "Undo", undo_post_version_path(post_version), :method => :put, :remote => true %> | <% end %> diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb index 31eaf3007..b42a5c943 100644 --- a/app/views/posts/partials/show/_information.html.erb +++ b/app/views/posts/partials/show/_information.html.erb @@ -6,7 +6,7 @@
  • Approver: <%= link_to_user(post.approver) %>
  • <% end %>
  • - Size: <%= link_to_if Danbooru.config.can_user_see_post?(CurrentUser.user, post), number_to_human_size(post.file_size), post.file_url %> + Size: <%= link_to_if post.visible?, number_to_human_size(post.file_size), post.file_url %> <% if post.is_image? %> (<%= post.image_width %>x<%= post.image_height %>) <% end %> diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 6f14c2bf7..15d4a6369 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -59,7 +59,7 @@
  • Comments
  • - <% if CurrentUser.is_member? && Danbooru.config.can_user_see_post?(CurrentUser.user, @post) %> + <% if CurrentUser.is_member? && @post.visible? %>
  • Edit
  • <% end %>
  • Share
  • @@ -78,7 +78,7 @@ <% end %> - <% if CurrentUser.is_member? && Danbooru.config.can_user_see_post?(CurrentUser.user, @post) && (CurrentUser.is_gold? || !@post.is_banned?) %> + <% if CurrentUser.is_member? && @post.visible? %>