mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
BUGFIX: seen logic was incomplete, you can have user_data and still unseen topic
This commit is contained in:
parent
ca170e4636
commit
5d0cae2dd1
1 changed files with 6 additions and 6 deletions
|
@ -29,18 +29,18 @@ class ListableTopicSerializer < BasicTopicSerializer
|
|||
end
|
||||
|
||||
def seen
|
||||
object.user_data.present?
|
||||
return true if !scope || !scope.user
|
||||
return true if object.user_data && !object.user_data.last_read_post_number.nil?
|
||||
return true if object.created_at < scope.user.treat_as_new_topic_start_date
|
||||
false
|
||||
end
|
||||
|
||||
def unseen
|
||||
return false if scope.blank?
|
||||
return false if scope.user.blank?
|
||||
return false if object.user_data.present?
|
||||
return false if object.created_at < scope.user.treat_as_new_topic_start_date
|
||||
true
|
||||
!seen
|
||||
end
|
||||
|
||||
def last_read_post_number
|
||||
return nil unless object.user_data
|
||||
object.user_data.last_read_post_number
|
||||
end
|
||||
alias :include_last_read_post_number? :seen
|
||||
|
|
Loading…
Reference in a new issue