DEV: Dedicated route for current user notification counts (#26106)

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
Penar Musaraj
2024-03-15 12:08:37 -04:00
committed by GitHub
parent ad7e3e04f3
commit 8cf2f909f5
11 changed files with 399 additions and 0 deletions

View File

@ -246,6 +246,16 @@ after_initialize do
.map { |row| { channel_id: row[0], data: row[1], thread_id: row[2] } }
end
add_to_serializer(
:user_notification_total,
:chat_notifications,
include_condition: -> do
return @has_chat_enabled if defined?(@has_chat_enabled)
@has_chat_enabled =
SiteSetting.chat_enabled && scope.can_chat? && object.user_option.chat_enabled
end,
) { Chat::ChannelFetcher.unreads_total(self.scope) }
add_to_serializer(:user_option, :chat_enabled) { object.chat_enabled }
add_to_serializer(