Class: UserNotificationTotalSerializer
Instance Method Summary
collapse
expire_cache_fragment!, fragment_cache
#include!
Instance Method Details
#group_inboxes ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/serializers/user_notification_total_serializer.rb', line 35
def group_inboxes
group_inbox_data =
Notification
.unread
.where(
user_id: scope.user.id,
notification_type: Notification.types[:group_message_summary],
)
.pluck(:data)
results = []
return results if group_inbox_data.blank?
group_inbox_data.map do |json|
data = JSON.parse(json, symbolize_names: true)
results << {
group_id: data[:group_id],
group_name: data[:group_name],
count: data[:inbox_count],
}
end
results
end
|
#include_unread_personal_messages? ⇒ Boolean
15
16
17
|
# File 'app/serializers/user_notification_total_serializer.rb', line 15
def include_unread_personal_messages?
object.in_any_groups?(SiteSetting.personal_message_enabled_groups_map)
end
|
#include_unseen_reviewables? ⇒ Boolean
23
24
25
|
# File 'app/serializers/user_notification_total_serializer.rb', line 23
def include_unseen_reviewables?
scope.user.staff?
end
|
#new_personal_messages_notifications_count ⇒ Object
62
63
64
|
# File 'app/serializers/user_notification_total_serializer.rb', line 62
def new_personal_messages_notifications_count
@new_personal_messages_notifications_count ||= object.new_personal_messages_notifications_count
end
|
#unread_notifications ⇒ Object
11
12
13
|
# File 'app/serializers/user_notification_total_serializer.rb', line 11
def unread_notifications
object.all_unread_notifications_count - new_personal_messages_notifications_count
end
|
#unread_personal_messages ⇒ Object
19
20
21
|
# File 'app/serializers/user_notification_total_serializer.rb', line 19
def unread_personal_messages
new_personal_messages_notifications_count
end
|
#unseen_reviewables ⇒ Object