mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FEATURE: Extend topic update API scope to allow status updates (#19654)
Allow an API key created with topic:update API scope to make updates to topic status. This change also introduces an optional category_id scope param.
This commit is contained in:
@ -479,7 +479,12 @@ class TopicsController < ApplicationController
|
||||
enabled = params[:enabled] == "true"
|
||||
|
||||
check_for_status_presence(:status, status)
|
||||
@topic = Topic.find_by(id: topic_id)
|
||||
@topic =
|
||||
if params[:category_id]
|
||||
Topic.find_by(id: topic_id, category_id: params[:category_id].to_i)
|
||||
else
|
||||
Topic.find_by(id: topic_id)
|
||||
end
|
||||
|
||||
case status
|
||||
when "closed"
|
||||
|
Reference in New Issue
Block a user