mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: You could update a topic to have a title that's too short if the TextCleaner
removed extra characters. Additionally, updating the title will not return an error message to the client app if the operation fails (rather than failing silently.)
This commit is contained in:
@@ -487,6 +487,11 @@ describe TopicsController do
|
||||
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, category: 'incredible'
|
||||
end
|
||||
|
||||
it "returns errors with invalid titles" do
|
||||
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, title: 'asdf'
|
||||
expect(response).not_to be_success
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,6 +43,15 @@ describe Topic do
|
||||
|
||||
end
|
||||
|
||||
context "updating a title to be shorter" do
|
||||
let!(:topic) { Fabricate(:topic) }
|
||||
|
||||
it "doesn't update it to be shorter due to cleaning using TextCleaner" do
|
||||
topic.title = 'unread glitch'
|
||||
topic.save.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
context 'topic title uniqueness' do
|
||||
|
||||
let!(:topic) { Fabricate(:topic) }
|
||||
|
||||
Reference in New Issue
Block a user