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
|
# url: https://git.stonecarterstudios.com/StoneCarterStudios/custom-digest-posts
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
module CustomUserNotifications
|
require_dependency 'user_notifications'
|
||||||
|
|
||||||
|
UserNotifications.class_eval do
|
||||||
def digest(user, opts = {})
|
def digest(user, opts = {})
|
||||||
super(user, opts).tap do
|
super(user, opts)
|
||||||
@popular_posts =
|
|
||||||
if SiteSetting.digest_posts > 0
|
@popular_posts =
|
||||||
Post
|
if SiteSetting.digest_posts > 0
|
||||||
.order("posts.score DESC")
|
Post
|
||||||
.for_mailing_list(user, @since)
|
.order("posts.score DESC")
|
||||||
.where("posts.post_type = ?", Post.types[:regular])
|
.for_mailing_list(user, @since)
|
||||||
.where("posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false")
|
.where("posts.post_type = ?", Post.types[:regular])
|
||||||
.where("posts.post_number > ?", 1)
|
.where("posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false")
|
||||||
.where("posts.created_at < ?", (SiteSetting.editing_grace_period || 0).seconds.ago)
|
.where("posts.post_number > ?", 1)
|
||||||
.limit(SiteSetting.digest_posts)
|
.where("posts.created_at < ?", (SiteSetting.editing_grace_period || 0).seconds.ago)
|
||||||
else
|
.limit(SiteSetting.digest_posts)
|
||||||
[]
|
else
|
||||||
end
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ::UserNotifications
|
|
||||||
prepend CustomUserNotifications
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user