mgabdev
2020-01-16 18:24:10 -05:00
parent 292991bf33
commit 7fb0b462e2
13 changed files with 91 additions and 8 deletions

View File

@@ -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