Fix syntax.
This commit is contained in:
20
plugin.rb
20
plugin.rb
@@ -42,15 +42,20 @@ after_initialize do
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
# Modified @popular_posts to remove score threshold
|
|
||||||
@popular_posts =
|
@popular_posts =
|
||||||
if SiteSetting.digest_posts > 0
|
if SiteSetting.digest_posts > 0
|
||||||
Post
|
Post
|
||||||
.order("posts.score DESC")
|
.order("posts.score DESC")
|
||||||
.for_mailing_list(user, @since)
|
.for_mailing_list(user, @since)
|
||||||
.where("posts.post_type = ?", Post.types[:regular])
|
.where("posts.post_type = ?", Post.types[:regular])
|
||||||
.where("posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false")
|
.where(
|
||||||
.where("posts.post_number > ?", 1)
|
"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)
|
.where("posts.created_at < ?", (SiteSetting.editing_grace_period || 0).seconds.ago)
|
||||||
.limit(SiteSetting.digest_posts)
|
.limit(SiteSetting.digest_posts)
|
||||||
else
|
else
|
||||||
@@ -66,6 +71,7 @@ after_initialize do
|
|||||||
|
|
||||||
# Try to find 3 interesting stats for the top of the digest
|
# Try to find 3 interesting stats for the top of the digest
|
||||||
new_topics_count = Topic.for_digest(user, @since).count
|
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
|
new_topics_count = topics_for_digest.size if new_topics_count == 0
|
||||||
|
|
||||||
@counts = [
|
@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
|
value = user.unread_notifications + user.unread_high_priority_notifications
|
||||||
if value > 0
|
if value > 0
|
||||||
@counts << {
|
@counts << {
|
||||||
@@ -96,7 +105,7 @@ after_initialize do
|
|||||||
value: value,
|
value: value,
|
||||||
href: "#{Discourse.base_url}/my/notifications",
|
href: "#{Discourse.base_url}/my/notifications",
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @counts.size < 3 && user.user_option.digest_after_minutes.to_i >= 1440
|
if @counts.size < 3 && user.user_option.digest_after_minutes.to_i >= 1440
|
||||||
@@ -108,7 +117,7 @@ after_initialize do
|
|||||||
value: value,
|
value: value,
|
||||||
href: "#{Discourse.base_url}/about",
|
href: "#{Discourse.base_url}/about",
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@preheader_text = I18n.t("user_notifications.digest.preheader", since: @since)
|
@preheader_text = I18n.t("user_notifications.digest.preheader", since: @since)
|
||||||
@@ -131,5 +140,4 @@ after_initialize do
|
|||||||
build_email(user.email, opts)
|
build_email(user.email, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user