mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
f2e7b74d88
When running `ensure_login_required` it should always happen prior to `check_xhr` cause check xhr will trigger a 200 response
21 lines
605 B
Ruby
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
|