fixes #2884: Comment unvoting is broken

This commit is contained in:
r888888888
2017-02-13 16:38:18 -08:00
parent 7aa0107e2b
commit 651dad473d
2 changed files with 9 additions and 11 deletions

View File

@@ -2,12 +2,10 @@
Danbooru.error("<%= j @error.to_s %>"); Danbooru.error("<%= j @error.to_s %>");
<% elsif @comment_vote.errors.any? %> <% elsif @comment_vote.errors.any? %>
Danbooru.error("<%= j @comment_vote.errors.full_messages.join('; ') %>"); Danbooru.error("<%= j @comment_vote.errors.full_messages.join('; ') %>");
<% else %> <% elsif @comment_vote.is_negative? %>
<% if @comment_vote.is_negative? %> $(".comment[data-comment-id=<%= @comment.id %>]").remove();
$(".comment[data-comment-id=<%= @comment.id %>]").remove();
<% end %>
$("#comment-vote-up-link-for-<%= @comment.id %>").hide();
$("#comment-vote-down-link-for-<%= @comment.id %>").hide();
$("#comment-unvote-link-for-<%= @comment.id %>").show();
<% end %> <% end %>
$("#comment-vote-up-link-for-<%= @comment.id %>").hide();
$("#comment-vote-down-link-for-<%= @comment.id %>").hide();
$("#comment-unvote-link-for-<%= @comment.id %>").show();

View File

@@ -17,7 +17,7 @@ namespace :images do
Post.where("id >= ? and id <= ?", min_id, max_id).find_each do |post| Post.where("id >= ? and id <= ?", min_id, max_id).find_each do |post|
key = File.basename(post.file_path) key = File.basename(post.file_path)
begin begin
client.copy_object(bucket: bucket, key: key, acl: "authenticated-read", storage_class: "STANDARD", copy_source: "/#{bucket}/#{key}", metadata_directive: "COPY") client.copy_object(bucket: bucket, key: key, acl: "public-read", storage_class: "STANDARD", copy_source: "/#{bucket}/#{key}", metadata_directive: "COPY")
puts "copied #{post.id}" puts "copied #{post.id}"
rescue Aws::S3::Errors::InvalidObjectState rescue Aws::S3::Errors::InvalidObjectState
puts "invalid state #{post.id}" puts "invalid state #{post.id}"
@@ -41,7 +41,7 @@ namespace :images do
bucket = Danbooru.config.aws_s3_bucket_name bucket = Danbooru.config.aws_s3_bucket_name
Post.where("id >= ? and id <= ?", min_id, max_id).find_each do |post| Post.where("id >= ? and id <= ?", min_id, max_id).find_each do |post|
key = File.basename(post.file_path) key = "preview/" + File.basename(post.preview_file_path)
begin begin
client.restore_object( client.restore_object(
bucket: bucket, bucket: bucket,
@@ -53,7 +53,7 @@ namespace :images do
} }
} }
) )
puts "uploaded #{post.id}" puts "restored #{post.id}"
rescue Aws::S3::Errors::InvalidObjectState rescue Aws::S3::Errors::InvalidObjectState
puts "already glaciered #{post.id}" puts "already glaciered #{post.id}"
rescue Aws::S3::Errors::NoSuchKey rescue Aws::S3::Errors::NoSuchKey