Updates
This commit is contained in:
40
plugin.rb
40
plugin.rb
@@ -5,27 +5,27 @@
|
||||
# url: https://git.stonecarterstudios.com/StoneCarterStudios/custom-digest-posts
|
||||
|
||||
after_initialize do
|
||||
module CustomUserNotifications
|
||||
require_dependency 'user_notifications'
|
||||
|
||||
UserNotifications.class_eval do
|
||||
def digest(user, opts = {})
|
||||
super(user, opts).tap do
|
||||
@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.created_at < ?", (SiteSetting.editing_grace_period || 0).seconds.ago)
|
||||
.limit(SiteSetting.digest_posts)
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
super(user, opts)
|
||||
|
||||
@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.created_at < ?", (SiteSetting.editing_grace_period || 0).seconds.ago)
|
||||
.limit(SiteSetting.digest_posts)
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
class ::UserNotifications
|
||||
prepend CustomUserNotifications
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user