feat: Update notifications and unread count in real time (#4261)

This commit is contained in:
Muhsin Keloth
2022-03-28 20:01:23 +05:30
committed by GitHub
parent ec0ea0b1dc
commit ccf52a620b
11 changed files with 78 additions and 6 deletions

View File

@@ -52,15 +52,24 @@ class Notification < ApplicationRecord
notification_type: notification_type,
primary_actor_type: primary_actor_type,
primary_actor_id: primary_actor_id,
primary_actor: primary_actor.push_event_data,
primary_actor: primary_actor_data,
read_at: read_at,
secondary_actor: secondary_actor&.push_event_data,
user: user&.push_event_data,
created_at: created_at,
account_id: account_id
created_at: created_at.to_i,
account_id: account_id,
push_message_title: push_message_title
}
end
def primary_actor_data
if %w[assigned_conversation_new_message conversation_mention].include? notification_type
primary_actor.conversation.push_event_data
else
primary_actor.push_event_data
end
end
def fcm_push_data
{
id: id,