summaryrefslogtreecommitdiff
path: root/lib/aggiedit_web/channels/post_channel.ex
diff options
context:
space:
mode:
authorLogan Hunt <loganhunt@simponic.xyz>2022-04-21 17:23:17 -0600
committerLogan Hunt <loganhunt@simponic.xyz>2022-04-21 17:23:17 -0600
commitf6b262ea668bfaef48be40efb809e791258e2417 (patch)
tree260cc539adf551576f28c0af1b1dcdb456958c00 /lib/aggiedit_web/channels/post_channel.ex
parentd9943b201d98a2396d62b9a190659e2e776da019 (diff)
downloadaggiedit-f6b262ea668bfaef48be40efb809e791258e2417.tar.gz
aggiedit-f6b262ea668bfaef48be40efb809e791258e2417.zip
Updates to frontend and fix a bug where first socket assignment failed
Diffstat (limited to 'lib/aggiedit_web/channels/post_channel.ex')
-rw-r--r--lib/aggiedit_web/channels/post_channel.ex5
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