fixes #2700: Unvote Missing Template Exception
This commit is contained in:
@@ -7,4 +7,11 @@ class CommentVotesController < ApplicationController
|
||||
@comment_vote = @comment.vote!(params[:score])
|
||||
respond_with(@comment_vote)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@comment = Comment.find(params[:comment_id])
|
||||
@comment.unvote!(params[:score])
|
||||
rescue CommentVote::Error => x
|
||||
@error = x
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,13 @@ class PostVotesController < ApplicationController
|
||||
@error = x
|
||||
end
|
||||
|
||||
def destroy
|
||||
@post = Post.find(params[:post_id])
|
||||
@post.unvote!
|
||||
rescue PostVote::Error => x
|
||||
@error = x
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def voter_only
|
||||
|
||||
5
app/views/comment_votes/destroy.json.erb
Normal file
5
app/views/comment_votes/destroy.json.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<% if @error %>
|
||||
{"success": false, "reason": <%= @error.to_s.to_json.html_safe %>}
|
||||
<% else %>
|
||||
{"success": true}
|
||||
<% end %>
|
||||
6
app/views/comment_votes/destroy.xml.erb
Normal file
6
app/views/comment_votes/destroy.xml.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<% if @error %>
|
||||
<response success="false"><%= @error.to_s %></response>
|
||||
<% else %>
|
||||
<response success="true"/>
|
||||
<% end %>
|
||||
5
app/views/post_votes/destroy.json.erb
Normal file
5
app/views/post_votes/destroy.json.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<% if @error %>
|
||||
{"success": false, "reason": <%= @error.to_s.to_json.html_safe %>}
|
||||
<% else %>
|
||||
{"success": true}
|
||||
<% end %>
|
||||
6
app/views/post_votes/destroy.xml.erb
Normal file
6
app/views/post_votes/destroy.xml.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<% if @error %>
|
||||
<response success="false"><%= @error.to_s %></response>
|
||||
<% else %>
|
||||
<response success="true"/>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user