diff options
author | href <href@random.sh> | 2021-09-03 14:39:34 +0200 |
---|---|---|
committer | href <href@random.sh> | 2021-09-03 14:39:34 +0200 |
commit | 11aa2f28bb15fd0dc0f4e1e037ed4875d934106e (patch) | |
tree | 21b1d4a5e3966565c485d0614b4fb24cfa822612 /lib/lsg_web/live/chat_live.ex | |
parent | puppet: stay connected for 12 hours (diff) |
chat_live improvements
Diffstat (limited to '')
-rw-r--r-- | lib/lsg_web/live/chat_live.ex | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/lsg_web/live/chat_live.ex b/lib/lsg_web/live/chat_live.ex index a2b4c13..d736d72 100644 --- a/lib/lsg_web/live/chat_live.ex +++ b/lib/lsg_web/live/chat_live.ex @@ -22,6 +22,8 @@ defmodule LSGWeb.ChatLive do Map.put(acc, id, user) end) + {backlog, _} = LSG.IRC.BufferPlugin.select_buffer(connection.network, chan) + socket = socket |> assign(:connection_id, connection.id) |> assign(:network, connection.network) @@ -29,7 +31,7 @@ defmodule LSGWeb.ChatLive do |> assign(:title, "live") |> assign(:channel, chan) |> assign(:account_id, account.id) - |> assign(:backlog, []) + |> assign(:backlog, Enum.reverse(backlog)) |> assign(:users, users) |> assign(:counter, 0) @@ -47,17 +49,11 @@ defmodule LSGWeb.ChatLive do def handle_info({:irc, :event, event = %{type: :join, user_id: id}}, socket) do if user = IRC.UserTrack.lookup(id) do - IO.puts("JOIN USER JOIN USER JOIN USER") - socket = socket |> assign(:users, Map.put(socket.assigns.users, id, user)) |> assign(:backlog, socket.assigns.backlog ++ [event]) - - IO.inspect(socket.assigns.users) - {:noreply, socket} else - IO.puts("\n\n\n?!\n\n\n?!\n\n\n\n") {:noreply, socket} end end |