mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 21:24:45 +08:00
FIX: Don't sort the new topics by score since the Top logic is already
sorting them by score.
This commit is contained in:
@ -47,11 +47,7 @@ class UserNotifications < ActionMailer::Base
|
|||||||
if @featured_topics.present?
|
if @featured_topics.present?
|
||||||
@featured_topics, @new_topics = @featured_topics[0..4], @featured_topics[5..-1]
|
@featured_topics, @new_topics = @featured_topics[0..4], @featured_topics[5..-1]
|
||||||
|
|
||||||
# Sort the new topics by score
|
|
||||||
@new_topics.sort! {|a, b| (b.score || 0) - (a.score || 0) } if @new_topics.present?
|
|
||||||
|
|
||||||
@markdown_linker = MarkdownLinker.new(Discourse.base_url)
|
@markdown_linker = MarkdownLinker.new(Discourse.base_url)
|
||||||
|
|
||||||
build_email user.email,
|
build_email user.email,
|
||||||
from_alias: I18n.t('user_notifications.digest.from', site_name: SiteSetting.title),
|
from_alias: I18n.t('user_notifications.digest.from', site_name: SiteSetting.title),
|
||||||
subject: I18n.t('user_notifications.digest.subject_template',
|
subject: I18n.t('user_notifications.digest.subject_template',
|
||||||
|
@ -272,8 +272,9 @@ class Topic < ActiveRecord::Base
|
|||||||
.where("COALESCE(topic_users.notification_level, 1) <> ?", TopicUser.notification_levels[:muted])
|
.where("COALESCE(topic_users.notification_level, 1) <> ?", TopicUser.notification_levels[:muted])
|
||||||
.created_since(since)
|
.created_since(since)
|
||||||
.listable_topics
|
.listable_topics
|
||||||
|
.includes(:category)
|
||||||
.order(TopicQuerySQL.order_top_for(score))
|
.order(TopicQuerySQL.order_top_for(score))
|
||||||
.limit(100)
|
.limit(20)
|
||||||
|
|
||||||
# Remove category topics
|
# Remove category topics
|
||||||
category_topic_ids = Category.pluck(:topic_id).compact!
|
category_topic_ids = Category.pluck(:topic_id).compact!
|
||||||
|
Reference in New Issue
Block a user