diff options
Diffstat (limited to 'lib/aggiedit_web/channels/post_channel.ex')
-rw-r--r-- | lib/aggiedit_web/channels/post_channel.ex | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/aggiedit_web/channels/post_channel.ex b/lib/aggiedit_web/channels/post_channel.ex index ea79d76..2b1c9b5 100644 --- a/lib/aggiedit_web/channels/post_channel.ex +++ b/lib/aggiedit_web/channels/post_channel.ex @@ -24,13 +24,14 @@ defmodule AggieditWeb.PostChannel do |> Enum.map(fn c -> Aggiedit.Post.Comment.serialize(c) end) push(socket, "initial-comments", %{:comments => comments}) + broadcast!(socket, "join", %{user: socket.assigns.current_user.username}) {:noreply, socket} end @impl true - def handle_in("send", %{"body" => comment}=body, socket) do + def handle_in("send", %{"body" => comment}, socket) do {:ok, comment} = Rooms.comment_post(socket.assigns.post, socket.assigns.current_user, comment) broadcast!(socket, "shout", Aggiedit.Post.Comment.serialize(comment)) {:reply, :ok, socket} end -end
\ No newline at end of file +end |