mirror of
https://github.com/discourse/discourse.git
synced 2026-07-30 08:08:20 -05:00
PERF: make score calculator cheaper when site has long topics
This commit is contained in:
@@ -49,6 +49,19 @@ describe ScoreCalculator do
|
||||
expect(topic.has_summary).to eq(false)
|
||||
end
|
||||
|
||||
it "respects the min_topic_age" do
|
||||
topic.update_columns(has_summary: true, bumped_at: 1.month.ago)
|
||||
ScoreCalculator.new(reads: 3).calculate(min_topic_age: 20.days.ago)
|
||||
expect(topic.has_summary).to eq(true)
|
||||
end
|
||||
|
||||
it "respects the max_topic_length" do
|
||||
Fabricate(:post, topic_id: topic.id)
|
||||
topic.update_columns(has_summary: true)
|
||||
ScoreCalculator.new(reads: 3).calculate(max_topic_length: 1)
|
||||
expect(topic.has_summary).to eq(true)
|
||||
end
|
||||
|
||||
it "won't update the site settings when the site settings don't match" do
|
||||
SiteSetting.expects(:summary_likes_required).returns(0)
|
||||
SiteSetting.expects(:summary_posts_required).returns(1)
|
||||
|
||||
Reference in New Issue
Block a user