fixes #2165
This commit is contained in:
@@ -17,7 +17,7 @@ class PostVersionsController < ApplicationController
|
|||||||
def undo
|
def undo
|
||||||
@post_version = PostVersion.find(params[:id])
|
@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!
|
@post_version.undo!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class PostsController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
@post = Post.find(params[:id])
|
@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)
|
@post.update_attributes(params[:post], :as => CurrentUser.role)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class PostsController < ApplicationController
|
|||||||
@post = Post.find(params[:id])
|
@post = Post.find(params[:id])
|
||||||
@version = PostVersion.find(params[:version_id])
|
@version = PostVersion.find(params[:version_id])
|
||||||
|
|
||||||
if Danbooru.config.can_user_see_post?(CurrentUser.user, @post)
|
if @post.visible?
|
||||||
@post.revert_to!(@version)
|
@post.revert_to!(@version)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1094,7 +1094,7 @@ class Post < ActiveRecord::Base
|
|||||||
module ApiMethods
|
module ApiMethods
|
||||||
def hidden_attributes
|
def hidden_attributes
|
||||||
list = [:tag_index]
|
list = [:tag_index]
|
||||||
if !Danbooru.config.can_user_see_post?(CurrentUser.user, self)
|
if !visible?
|
||||||
list += [:md5, :file_ext]
|
list += [:md5, :file_ext]
|
||||||
end
|
end
|
||||||
super + list
|
super + list
|
||||||
@@ -1102,7 +1102,7 @@ class Post < ActiveRecord::Base
|
|||||||
|
|
||||||
def method_attributes
|
def method_attributes
|
||||||
list = [:uploader_name, :has_large, :tag_string_artist, :tag_string_character, :tag_string_copyright, :tag_string_general]
|
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]
|
list += [:file_url, :large_file_url, :preview_file_url]
|
||||||
end
|
end
|
||||||
list
|
list
|
||||||
@@ -1147,7 +1147,7 @@ class Post < ActiveRecord::Base
|
|||||||
"id" => id
|
"id" => id
|
||||||
}
|
}
|
||||||
|
|
||||||
if Danbooru.config.can_user_see_post?(CurrentUser.user, self)
|
if visible?
|
||||||
hash["file_url"] = file_url
|
hash["file_url"] = file_url
|
||||||
hash["preview_url"] = preview_file_url
|
hash["preview_url"] = preview_file_url
|
||||||
hash["md5"] = md5
|
hash["md5"] = md5
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<%= render "post_sets/blank" %>
|
<%= render "post_sets/blank" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% @posts.select {|x| Danbooru.config.can_user_see_post?(CurrentUser.user, x)}.each do |post| %>
|
<% @posts.select {|x| x.visible?}.each do |post| %>
|
||||||
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<% if post.visible? %>
|
<% if post.visible? %>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<td><%= post_version_diff(post_version) %></td>
|
<td><%= post_version_diff(post_version) %></td>
|
||||||
<% if CurrentUser.is_member? %>
|
<% if CurrentUser.is_member? %>
|
||||||
<td>
|
<td>
|
||||||
<% 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 %>
|
<% if post_version.id != post_version.post.versions.first.id %>
|
||||||
<%= link_to "Undo", undo_post_version_path(post_version), :method => :put, :remote => true %> |
|
<%= link_to "Undo", undo_post_version_path(post_version), :method => :put, :remote => true %> |
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<li>Approver: <%= link_to_user(post.approver) %></li>
|
<li>Approver: <%= link_to_user(post.approver) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li>
|
<li>
|
||||||
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? %>
|
<% if post.is_image? %>
|
||||||
(<%= post.image_width %>x<%= post.image_height %>)
|
(<%= post.image_width %>x<%= post.image_height %>)
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<menu id="post-sections">
|
<menu id="post-sections">
|
||||||
<li><a href="#comments">Comments</a></li>
|
<li><a href="#comments">Comments</a></li>
|
||||||
<% if CurrentUser.is_member? && Danbooru.config.can_user_see_post?(CurrentUser.user, @post) %>
|
<% if CurrentUser.is_member? && @post.visible? %>
|
||||||
<li><a href="#edit" id="post-edit-link">Edit</a></li>
|
<li><a href="#edit" id="post-edit-link">Edit</a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li><a href="#share">Share</a></li>
|
<li><a href="#share">Share</a></li>
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<% 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? %>
|
||||||
<section id="edit" style="display: none;">
|
<section id="edit" style="display: none;">
|
||||||
<%= render "posts/partials/show/edit", :post => @post %>
|
<%= render "posts/partials/show/edit", :post => @post %>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user