diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 916039cb..196fcf01 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -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 diff --git a/app/controllers/user_exercise_feedbacks_controller.rb b/app/controllers/user_exercise_feedbacks_controller.rb index ed0e77fd..a001b65e 100644 --- a/app/controllers/user_exercise_feedbacks_controller.rb +++ b/app/controllers/user_exercise_feedbacks_controller.rb @@ -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')], diff --git a/app/views/request_for_comments/show.html.slim b/app/views/request_for_comments/show.html.slim index 1111e2b8..499abbcb 100644 --- a/app/views/request_for_comments/show.html.slim +++ b/app/views/request_for_comments/show.html.slim @@ -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]) diff --git a/config/routes.rb b/config/routes.rb index e13c3b52..9c9584d8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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