mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 05:03:58 +08:00
FEATURE: Re-prioritize related so unread is always first
This commit is contained in:
parent
8977d5917b
commit
228f7542da
|
@ -70,14 +70,6 @@ class SuggestedTopicsBuilder
|
||||||
SiteSetting.suggested_topics - @results.count{|r| r.category_id == @category_id}
|
SiteSetting.suggested_topics - @results.count{|r| r.category_id == @category_id}
|
||||||
end
|
end
|
||||||
|
|
||||||
def category_full?
|
|
||||||
if @category_id
|
|
||||||
|
|
||||||
else
|
|
||||||
full?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def size
|
def size
|
||||||
@results.size
|
@results.size
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,9 +56,9 @@ class TopicQuery
|
||||||
# When logged in we start with different results
|
# When logged in we start with different results
|
||||||
if @user
|
if @user
|
||||||
builder.add_results(unread_results(topic: topic, per_page: builder.results_left), :high)
|
builder.add_results(unread_results(topic: topic, per_page: builder.results_left), :high)
|
||||||
builder.add_results(new_results(topic: topic, per_page: builder.category_results_left), :high) unless builder.category_full?
|
builder.add_results(new_results(topic: topic, per_page: builder.category_results_left)) unless builder.full?
|
||||||
end
|
end
|
||||||
builder.add_results(random_suggested(topic, builder.results_left, builder.excluded_topic_ids), :low) unless builder.full?
|
builder.add_results(random_suggested(topic, builder.results_left, builder.excluded_topic_ids)) unless builder.full?
|
||||||
|
|
||||||
create_list(:suggested, {}, builder.results)
|
create_list(:suggested, {}, builder.results)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user