FIX: topic_creator accepts participant_count in import mode (#10632)

The issue mentioned here: https://meta.discourse.org/t/imported-private-discussion-doesnt-appear-in-the-author-inbox/163252

`participant_count` is important to attribute for private messages. If they are imported, we should allow them to set that attribute.

A workaround would be evaluating `update_statistics` method on each Topic but that is less performant.
This commit is contained in:
Krzysztof Kotlarek
2020-09-10 08:16:57 +10:00
committed by GitHub
parent cac64a95aa
commit d260e42c8a
2 changed files with 14 additions and 0 deletions

View File

@ -70,6 +70,16 @@ describe TopicCreator do
expect(topic).to be_valid
expect(topic.category).to eq(category)
end
it "ignores participant_count without raising an error" do
topic = TopicCreator.create(user, Guardian.new(user), valid_attrs.merge(participant_count: 3))
expect(topic.participant_count).to eq(1)
end
it "accepts participant_count in import mode" do
topic = TopicCreator.create(user, Guardian.new(user), valid_attrs.merge(import_mode: true, participant_count: 3))
expect(topic.participant_count).to eq(3)
end
end
end