FIX: Don't render error for bad-sequence (#21187)

We are seeing issues with the composer not being able to close due to the addition of a error message when rescuing from `Draft::OutOfSequence`. This PR will revert to the original solution implemented prior to https://github.com/discourse/discourse/pull/21148 that just silently rescues from `Draft::OutOfSequence`
This commit is contained in:
Isaac Janzen
2023-04-20 10:26:11 -05:00
committed by GitHub
parent 8b438767e5
commit ce9cccb2fc
2 changed files with 3 additions and 10 deletions

View File

@ -100,8 +100,9 @@ class DraftsController < ApplicationController
begin
Draft.clear(user, params[:id], params[:sequence].to_i)
rescue Draft::OutOfSequence => e
return render json: failed_json.merge(errors: e), status: 404
rescue Draft::OutOfSequence
# nothing really we can do here, if try clearing a draft that is not ours, just skip it.
# rendering an error causes issues in the composer
rescue StandardError => e
return render json: failed_json.merge(errors: e), status: 401
end