mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Ensure soft-deleted topics can be deleted (#19802)
* FIX: Ensure soft-deleted topics can be deleted The topic was not found during the deletion process because it was deleted and `@post.topic` was nil. * DEV: Use @topic instead of finding the topic every time
This commit is contained in:
@@ -649,7 +649,9 @@ class TopicsController < ApplicationController
|
||||
force_destroy = ActiveModel::Type::Boolean.new.cast(params[:force_destroy])
|
||||
|
||||
if force_destroy
|
||||
if !guardian.can_permanently_delete?(topic)
|
||||
if !topic
|
||||
raise Discourse::InvalidAccess
|
||||
elsif !guardian.can_permanently_delete?(topic)
|
||||
return render_json_error topic.cannot_permanently_delete_reason(current_user), status: 403
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user