app/controllers/event_service/feedbacks_controller.rb
def create
      mailer_params = feedback_params
      mailer_params[:email] = session_user.email if session_user

      problem = EventService::ProblemReport.new(
        { user_id: session_user&.id }.merge(mailer_params)
      )

      if problem.save
        mailer_params[:issue_id] = problem.id
        mailer = ::NewProblemMailer.with(mailer_params)
        mailer.report_email.deliver_later
        render json: { feedback: { id: problem.id } }
      else
        render json: { errors: problem.errors&.messages&.map{|k,v| k.to_s + ' ' + v.first.to_s } }, status: :unprocessable_entity
      end
    end
# This controller does not have CSRF check by purpose!
# This is to avoid blocking feedbacks in case of any issue with CSRF protection
This controller does not have CSRF check by purpose.
This is to avoid blocking feedbacks in case of any issue with CSRF protection
This controller does not have CSRF check by purpose . This is to avoid blocking feedbacks in case of any issue with CSRF protection
def create
      mailer_params = feedback_params
      mailer_params[:email] = session_user.email if session_user
      problem = EventService::ProblemReport.new(
        { user_id: session_user&.id }.merge(mailer_params)
      )
      if problem.save
        mailer_params[:issue_id] = problem.id
        mailer = ::NewProblemMailer.with(mailer_params)
        mailer.report_email.deliver_later
        render json: { feedback: { id: problem.id } }
      else
        render json: { errors: problem.errors&.messages&.map{|k,v| k.to_s + ' ' + v.first.to_s } }, status: :unprocessable_entity
      end
    end
def create mailer_params = feedback_params mailer_params [ :email ] = session_user . email if session_user problem = EventService :: ProblemReport . new ( { user_id : session_user &. id } . merge ( mailer_params ) ) if problem . save mailer_params [ :issue_id ] = problem . id mailer = :: NewProblemMailer . with ( mailer_params ) mailer . report_email . deliver_later render json : { feedback : { id : problem . id } } else render json : { errors : problem . errors &. messages &. map { | k , v | k . to_s + ' ' + v . first . to_s } } , status : :unprocessable_entity end end
This controller does not have CSRF check by purpose!
This controller does not have CSRF check by purpose!