mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: Consistently handle category param
See https://meta.discourse.org/t/api-post-to-posts-json-inconsistent-between-users/118571
for more info.
This commit removes a 5 year old temporary fix that is no longer needed.
bc1824a6ed (diff-d8c648926664f849aec050757bfcb6f9R72)
The web interface uses category_id when creating a topic so I think we
should unify on category_id when using the api.
This commit is contained in:

committed by
Guo Xiang Tan

parent
bfea922167
commit
373b8a2139
@ -153,13 +153,8 @@ class TopicCreator
|
||||
return Category.find(SiteSetting.shared_drafts_category)
|
||||
end
|
||||
|
||||
# Temporary fix to allow older clients to create topics.
|
||||
# When all clients are updated the category variable should
|
||||
# be set directly to the contents of the if statement.
|
||||
if (@opts[:category].is_a? Integer) || (@opts[:category] =~ /^\d+$/)
|
||||
Category.find_by(id: @opts[:category])
|
||||
else
|
||||
Category.find_by(name_lower: @opts[:category].try(:downcase))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user