discourse/app/controllers/draft_controller.rb
Sam f2e7b74d88 FIX: don't return 200s when login is required to paths
When running `ensure_login_required` it should always happen prior to
`check_xhr` cause check xhr will trigger a 200 response
2018-02-01 12:26:45 +11:00

21 lines
605 B
Ruby

class DraftController < ApplicationController
prepend_before_action :ensure_logged_in
skip_before_action :check_xhr, :preload_json
def show
seq = params[:sequence] || DraftSequence.current(current_user, params[:draft_key])
render json: { draft: Draft.get(current_user, params[:draft_key], seq), draft_sequence: seq }
end
def update
Draft.set(current_user, params[:draft_key], params[:sequence].to_i, params[:data])
render json: success_json
end
def destroy
Draft.clear(current_user, params[:draft_key], params[:sequence].to_i)
render json: success_json
end
end