Commit
A 500 error was actually caused with no response when using the api, so it wasn't very clear that you need to delete the posts first when using the api.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,7 +379,10 @@ def destroy | |
} | ||
end | ||
rescue UserDestroyer::PostsExistError | ||
raise Discourse::InvalidAccess.new("User #{user.username} has #{user.post_count} posts, so can't be deleted.") | ||
render json: { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
oblakeerickson
Author
Member
|
||
deleted: false, | ||
message: "User #{user.username} has #{user.post_count} posts, so they can't be deleted." | ||
} | ||
end | ||
end | ||
end | ||
|
@oblakeerickson The change here doesn't look right to me. If a
Discourse::InvalidAccess
error is raised, it should be rescued in application controller. We're changing the status code from403
to200
which I don't think is correct.