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:
Blake Erickson
2019-05-24 11:16:19 -06:00
committed by Guo Xiang Tan
parent bfea922167
commit 373b8a2139
4 changed files with 8 additions and 13 deletions

View File

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