Fix notifications
https://gitlab.com/soapbox-pub/soapbox/merge_requests/120/diffs#diff-content-917c7fb80cf426cfae1e7baaa21b3d90ccb2b29c
This commit is contained in:
@@ -36,6 +36,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
store[:advanced_layout] = object.current_account.user.setting_advanced_layout
|
||||
store[:group_in_home_feed] = object.current_account.user.setting_group_in_home_feed
|
||||
store[:is_staff] = object.current_account.user.staff?
|
||||
store[:unread_count] = unread_count object.current_account
|
||||
end
|
||||
|
||||
store
|
||||
@@ -78,6 +79,11 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
|
||||
private
|
||||
|
||||
def unread_count(account)
|
||||
last_read = account.user.last_read_notification || 0
|
||||
account.notifications.where("id > #{last_read}").count
|
||||
end
|
||||
|
||||
def instance_presenter
|
||||
@instance_presenter ||= InstancePresenter.new
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user