A platform for community discussion. Free, open, simple.
FIX: raise `Discourse::NotFound` unless the topic is present
Arpit Jalan539f1c62528a
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rbindex 12c1e99bf06..ae1ecff512d 100644--- a/app/controllers/topics_controller.rb+++ b/app/controllers/topics_controller.rb@@ -501,9 +501,11 @@ class TopicsController < ApplicationControllerparams.require(:username)topic = Topic.find_by(id: params[:topic_id])user = User.find_by(username: params[:username])++ raise Discourse::NotFound unless topicguardian.ensure_can_remove_allowed_users!(topic, user)- if topic&.remove_allowed_user(current_user, user)+ if topic.remove_allowed_user(current_user, user)render json: success_jsonelserender json: failed_json, status: 422