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:
Selase Krakani
2023-01-13 01:21:04 +00:00
committed by GitHub
parent 8a1b50f62d
commit 73ec80893d
5 changed files with 103 additions and 5 deletions

View File

@ -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"