Remove leftovers from PR #117; exercise feedback on RfC show

This commit is contained in:
Sebastian Serth
2020-10-20 12:15:45 +02:00
parent d25dd41ccf
commit 9ddeb91c41
4 changed files with 2 additions and 21 deletions

View File

@ -111,20 +111,6 @@ class RequestForCommentsController < ApplicationController
authorize!
end
def create_comment_exercise
old = UserExerciseFeedback.find_by(exercise_id: params[:exercise_id], user_id: current_user.id, user_type: current_user.class.name)
if old
old.delete
end
uef = UserExerciseFeedback.new(comment_params)
if uef.save
render(json: {success: "true"})
else
render(json: {success: "false"})
end
end
# DELETE /request_for_comments/1
# DELETE /request_for_comments/1.json
def destroy
@ -148,8 +134,4 @@ class RequestForCommentsController < ApplicationController
params.require(:request_for_comment).permit(:exercise_id, :file_id, :question, :requested_at, :solved, :submission_id).merge(user_id: current_user.id, user_type: current_user.class.name)
end
def comment_params
params.permit(:exercise_id, :feedback_text).merge(user_id: current_user.id, user_type: current_user.class.name)
end
end

View File

@ -1,7 +1,7 @@
class UserExerciseFeedbacksController < ApplicationController
include CommonBehavior
before_action :set_user_exercise_feedback, only: [:edit, :update, :show, :destroy]
before_action :set_user_exercise_feedback, only: [:edit, :update, :destroy]
def comment_presets
[[0,t('user_exercise_feedback.difficulty_easy')],

View File

@ -1,5 +1,5 @@
.list-group
h4#exercise_caption.list-group-item-heading data-comment-exercise-url=create_comment_exercise_request_for_comment_path data-exercise-id="#{@request_for_comment.exercise.id}" data-rfc-id="#{@request_for_comment.id}"
h4#exercise_caption.list-group-item-heading data-exercise-id="#{@request_for_comment.exercise.id}" data-rfc-id="#{@request_for_comment.id}"
- if @request_for_comment.solved?
span.fa.fa-check aria-hidden="true"
= link_to_if(policy(@request_for_comment.exercise).show?, @request_for_comment.exercise.title, [:implement, @request_for_comment.exercise])

View File

@ -17,7 +17,6 @@ Rails.application.routes.draw do
resources :request_for_comments do
member do
get :mark_as_solved, defaults: { format: :json }
post :create_comment_exercise, defaults: { format: :json }
post :set_thank_you_note, defaults: { format: :json }
end
end