Revert "FIX: Return error if new topic category not found"

Revert “FIX: Return error if new topic category not found”

This reverts commit 9c606dd99a7ce227bde38527986b250d6e6c22dc.

diff --git a/lib/topic_creator.rb b/lib/topic_creator.rb
index 57b921f..f65f302 100644
--- a/lib/topic_creator.rb
+++ b/lib/topic_creator.rb
@@ -122,9 +122,6 @@ class TopicCreator
 
     @guardian.ensure_can_create!(Topic, category) unless (@opts[:skip_validations] || @opts[:archetype] == Archetype.private_message)
 
-    if @opts[:category] && category.nil?
-      raise Discourse::NotFound
-    end
     topic_params[:category_id] = category.id if category.present?
 
     topic_params[:created_at] = Time.zone.parse(@opts[:created_at].to_s) if @opts[:created_at].present?
diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rb
index af119c5..3657507 100644
--- a/spec/requests/posts_controller_spec.rb
+++ b/spec/requests/posts_controller_spec.rb
@@ -775,20 +775,6 @@ describe PostsController do
         }
         expect(response.status).to eq(403)
       end
-
-      it 'will raise an error if specified category cannot be found' do
-        user = Fabricate(:admin)
-        master_key = ApiKey.create_master_key.key
-
-        post "/posts.json", params: {
-          api_username: user.username,
-          api_key: master_key,
-          title: 'this is a test title',
-          raw: 'this is test body',
-          category: 'invalid'
-        }
-        expect(response.status).to eq(404)
-      end
     end
 
     describe "when logged in" do

GitHub sha: 535c5948

@oblakeerickson I had to revert this because an uncategorized category can no longer be created which broke our smoke tests.

1 Like

FIX: Return error if new topic category not found take 2