comments: allow swapping votes.
Allow users to upvote a comment, then downvote it, without raising an error or having to manually remove the upvote first. The upvote is automatically removed and replaced by the downvote. Changes to the /comment_votes API: * `POST /comment_votes` and `DELETE /comment_votes` now return a comment vote instead of a comment. * The `score` param in `POST /comment_votes` is now 1 or -1, not `up` or `down.`
This commit is contained in:
@@ -1,2 +1,6 @@
|
||||
var $comment = $("article#comment_<%= @comment.id %>");
|
||||
$comment.replaceWith("<%= j render_comment(@comment, current_user: CurrentUser.user) %>");
|
||||
<% if flash[:notice] %>
|
||||
Danbooru.Utility.notice("<%= j flash[:notice] %>");
|
||||
<% end %>
|
||||
|
||||
var $comment = $("article#comment_<%= @comment_vote.comment_id %>");
|
||||
$comment.replaceWith("<%= j render_comment(@comment_vote.comment, current_user: CurrentUser.user) %>");
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
var $comment = $("article#comment_<%= @comment.id %>");
|
||||
$comment.replaceWith("<%= j render_comment(@comment, current_user: CurrentUser.user) %>");
|
||||
1
app/views/comment_votes/destroy.js.erb
Symbolic link
1
app/views/comment_votes/destroy.js.erb
Symbolic link
@@ -0,0 +1 @@
|
||||
create.js.erb
|
||||
Reference in New Issue
Block a user