FIX: Confirm draft_key is present on GET

Also adds a test for the `show` action which did not exist
This commit is contained in:
Robin Ward
2020-02-14 11:06:12 -05:00
parent bfdd42c53a
commit dafa354d3d
2 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,8 @@ class DraftController < ApplicationController
skip_before_action :check_xhr, :preload_json
def show
raise Discourse::NotFound.new if params[:draft_key].blank?
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