Skip to content

Commit

Permalink
Setup unread messages
Browse files Browse the repository at this point in the history
  • Loading branch information
MICHAELMUNAVU83 committed Feb 6, 2025
1 parent b55b122 commit bb0538c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/animina_web/live/my_chats_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ defmodule AniminaWeb.MyChatsLive do
end

def handle_info({:new_message, message}, socket) do
unread_messages = socket.assigns.unread_messages ++ [message]

{:noreply,
socket
|> assign(unread_messages: unread_messages)
|> assign(number_of_unread_messages: Enum.count(unread_messages))
|> assign(:conversations, Message.get_conversations(socket.assigns.current_user.id))}
end

Expand Down

0 comments on commit bb0538c

Please sign in to comment.