mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: couldn't uncategorize a topic
This commit is contained in:
@ -133,7 +133,7 @@ class TopicsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
changes.delete(:title) if topic.title == changes[:title]
|
changes.delete(:title) if topic.title == changes[:title]
|
||||||
changes.delete(:category_id) if (changes[:category_id].blank? or topic.category_id == changes[:category_id].to_i)
|
changes.delete(:category_id) if topic.category_id == changes[:category_id].to_i
|
||||||
|
|
||||||
success = true
|
success = true
|
||||||
if changes.length > 0
|
if changes.length > 0
|
||||||
|
@ -724,6 +724,11 @@ describe TopicsController do
|
|||||||
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, category_id: 123
|
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, category_id: 123
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'allows to change category to "uncategorized"' do
|
||||||
|
Topic.any_instance.expects(:change_category_to_id).with(0).returns(true)
|
||||||
|
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, category_id: ""
|
||||||
|
end
|
||||||
|
|
||||||
it "returns errors with invalid titles" do
|
it "returns errors with invalid titles" do
|
||||||
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, title: 'asdf'
|
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, title: 'asdf'
|
||||||
expect(response).not_to be_success
|
expect(response).not_to be_success
|
||||||
|
Reference in New Issue
Block a user