fixes #2822: Post vote API: returns 200 for both success and failure; fixes bug with x-api-limit header
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
<% if @comment_vote.errors.any? %>
|
||||
<% if @error %>
|
||||
Danbooru.error("<%= j @error.to_s %>");
|
||||
<% elsif @comment_vote.errors.any? %>
|
||||
Danbooru.error("<%= j @comment_vote.errors.full_messages.join('; ') %>");
|
||||
<% else %>
|
||||
<% if @comment_vote.is_negative? %>
|
||||
$(".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 %>
|
||||
$("#comment-vote-up-link-for-<%= @comment.id %>").hide();
|
||||
$("#comment-vote-down-link-for-<%= @comment.id %>").hide();
|
||||
$("#comment-unvote-link-for-<%= @comment.id %>").show();
|
||||
7
app/views/comment_votes/destroy.js.erb
Normal file
7
app/views/comment_votes/destroy.js.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<% if @error %>
|
||||
Danbooru.error("<%= j @error.to_s %>");
|
||||
<% else %>
|
||||
<% if @comment_vote.is_negative? %>
|
||||
$(".comment[data-comment-id=<%= @comment.id %>]").remove();
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -3,6 +3,6 @@
|
||||
<% else %>
|
||||
Danbooru.notice("Vote saved");
|
||||
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
|
||||
$("#vote-links-for-post-<%= @post.id %>").hide();
|
||||
$("#unvote-link-for-post-<%= @post.id %>").show();
|
||||
<% end %>
|
||||
$("#vote-links-for-post-<%= @post.id %>").hide();
|
||||
$("#unvote-link-for-post-<%= @post.id %>").show();
|
||||
Reference in New Issue
Block a user