mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: whisper no longer experimental
- Regular users are not notified of whispers - Regular users no longer have "stuck" topics in unread - Additional tracking for staff highest post number - Remove a bunch of unused columns in topics table
This commit is contained in:
@ -2,7 +2,8 @@ class Unread
|
||||
|
||||
# This module helps us calculate unread and new post counts
|
||||
|
||||
def initialize(topic, topic_user)
|
||||
def initialize(topic, topic_user, guardian)
|
||||
@guardian = guardian
|
||||
@topic = topic
|
||||
@topic_user = topic_user
|
||||
end
|
||||
@ -18,9 +19,12 @@ class Unread
|
||||
def new_posts
|
||||
return 0 if @topic_user.highest_seen_post_number.blank?
|
||||
return 0 if do_not_notify?(@topic_user.notification_level)
|
||||
return 0 if (@topic_user.last_read_post_number||0) > @topic.highest_post_number
|
||||
|
||||
new_posts = (@topic.highest_post_number - @topic_user.highest_seen_post_number)
|
||||
highest_post_number = @guardian.is_staff? ? @topic.highest_staff_post_number : @topic.highest_post_number
|
||||
|
||||
return 0 if (@topic_user.last_read_post_number||0) > highest_post_number
|
||||
|
||||
new_posts = (highest_post_number - @topic_user.highest_seen_post_number)
|
||||
new_posts = 0 if new_posts < 0
|
||||
return new_posts
|
||||
end
|
||||
|
Reference in New Issue
Block a user