mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Add a better from address to the email
This commit is contained in:
parent
7c1ae451fe
commit
421f048458
4 changed files with 40 additions and 11 deletions
|
@ -157,9 +157,13 @@ class TopicQuery
|
|||
results = default_list(unordered: true, per_page: count)
|
||||
.where('topics.id NOT IN (?)', exclude_topic_ids)
|
||||
.where(closed: false, archived: false, visible: true)
|
||||
.order('RANDOM()')
|
||||
|
||||
results = results.where('category_id = ?', topic.category_id) if topic.category_id.present?
|
||||
if topic.category_id.present?
|
||||
results = results.order("CASE WHEN topics.category_id = #{topic.category_id.to_i} THEN 0 ELSE 1 END, RANDOM()")
|
||||
else
|
||||
results = results.order("RANDOM()")
|
||||
end
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue