mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 20:45:51 +00:00
FIX: raise Discourse::NotFound
unless the topic is present
This commit is contained in:
parent
439b3fe10a
commit
539f1c6252
@ -501,9 +501,11 @@ class TopicsController < ApplicationController
|
||||
params.require(:username)
|
||||
topic = Topic.find_by(id: params[:topic_id])
|
||||
user = User.find_by(username: params[:username])
|
||||
|
||||
raise Discourse::NotFound unless topic
|
||||
guardian.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_json
|
||||
else
|
||||
render json: failed_json, status: 422
|
||||
|
Loading…
x
Reference in New Issue
Block a user