Fix syntax.
This commit is contained in:
20
plugin.rb
20
plugin.rb
@@ -42,15 +42,20 @@ after_initialize do
|
||||
end
|
||||
)
|
||||
|
||||
# Modified @popular_posts to remove score threshold
|
||||
@popular_posts =
|
||||
if SiteSetting.digest_posts > 0
|
||||
Post
|
||||
.order("posts.score DESC")
|
||||
.for_mailing_list(user, @since)
|
||||
.where("posts.post_type = ?", Post.types[:regular])
|
||||
.where("posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false")
|
||||
.where("posts.post_number > ?", 1)
|
||||
.where(
|
||||
"posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false",
|
||||
)
|
||||
.where(
|
||||
"posts.post_number > ? AND posts.score > ?",
|
||||
1,
|
||||
ScoreCalculator.default_score_weights[:like_score] * 5.0,
|
||||
)
|
||||
.where("posts.created_at < ?", (SiteSetting.editing_grace_period || 0).seconds.ago)
|
||||
.limit(SiteSetting.digest_posts)
|
||||
else
|
||||
@@ -66,6 +71,7 @@ after_initialize do
|
||||
|
||||
# Try to find 3 interesting stats for the top of the digest
|
||||
new_topics_count = Topic.for_digest(user, @since).count
|
||||
# We used topics from new users instead, so count should match
|
||||
new_topics_count = topics_for_digest.size if new_topics_count == 0
|
||||
|
||||
@counts = [
|
||||
@@ -77,6 +83,9 @@ after_initialize do
|
||||
},
|
||||
]
|
||||
|
||||
# totalling unread notifications (which are low-priority only) and unread
|
||||
# PMs and bookmark reminder notifications, so the total is both unread low
|
||||
# and high priority PMs
|
||||
value = user.unread_notifications + user.unread_high_priority_notifications
|
||||
if value > 0
|
||||
@counts << {
|
||||
@@ -96,7 +105,7 @@ after_initialize do
|
||||
value: value,
|
||||
href: "#{Discourse.base_url}/my/notifications",
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if @counts.size < 3 && user.user_option.digest_after_minutes.to_i >= 1440
|
||||
@@ -108,7 +117,7 @@ after_initialize do
|
||||
value: value,
|
||||
href: "#{Discourse.base_url}/about",
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@preheader_text = I18n.t("user_notifications.digest.preheader", since: @since)
|
||||
@@ -132,4 +141,3 @@ after_initialize do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user