mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
Merge pull request #3210 from Flink/bugfix-regression-topics-controller
Fix regression on editing private messages
This commit is contained in:
commit
3614038a5d
2 changed files with 17 additions and 1 deletions
|
@ -133,7 +133,7 @@ class TopicsController < ApplicationController
|
|||
end
|
||||
|
||||
changes.delete(:title) if topic.title == changes[:title]
|
||||
changes.delete(:category_id) if topic.category_id == changes[:category_id].to_i
|
||||
changes.delete(:category_id) if topic.category_id.to_i == changes[:category_id].to_i
|
||||
|
||||
success = true
|
||||
if changes.length > 0
|
||||
|
|
|
@ -752,6 +752,22 @@ describe TopicsController do
|
|||
expect(response).to be_success
|
||||
end
|
||||
|
||||
context 'when topic is private' do
|
||||
before do
|
||||
@topic.archetype = Archetype.private_message
|
||||
@topic.category = nil
|
||||
@topic.save!
|
||||
end
|
||||
|
||||
context 'when there are no changes' do
|
||||
it 'does not call the PostRevisor' do
|
||||
PostRevisor.any_instance.expects(:revise!).never
|
||||
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, title: @topic.title, category_id: nil
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "allow_uncategorized_topics is false" do
|
||||
before do
|
||||
SiteSetting.stubs(:allow_uncategorized_topics).returns(false)
|
||||
|
|
Loading…
Reference in a new issue