Remove code to delete all comments on one line and restore default delete route for comments

This commit is contained in:
Maximilian Grundke
2017-08-25 18:15:02 +02:00
parent 771793f32e
commit 6aaa0f3bca
3 changed files with 5 additions and 22 deletions

View File

@ -1,5 +1,5 @@
class CommentsController < ApplicationController
before_action :set_comment, only: [:show, :edit, :update, :destroy_by_id]
before_action :set_comment, only: [:show, :edit, :update, :destroy]
# to disable authorization check: comment the line below back in
# skip_after_action :verify_authorized
@ -84,7 +84,8 @@ class CommentsController < ApplicationController
# DELETE /comments/1
# DELETE /comments/1.json
def destroy_by_id
def destroy
authorize!
@comment.destroy
respond_to do |format|
format.html { head :no_content, notice: 'Comment was successfully destroyed.' }
@ -92,16 +93,6 @@ class CommentsController < ApplicationController
end
end
def destroy
@comments = Comment.where(file_id: params[:file_id], row: params[:row], user: current_user)
@comments.each { |comment| authorize comment; comment.destroy }
respond_to do |format|
#format.html { redirect_to comments_url, notice: 'Comments were successfully destroyed.' }
format.html { head :no_content, notice: 'Comments were successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_comment