summaryrefslogtreecommitdiff
path: root/lib/aggiedit_web/live/post_live/show.ex
diff options
context:
space:
mode:
authorLogan Hunt <loganhunt@simponic.xyz>2022-04-20 16:03:17 -0600
committerLogan Hunt <loganhunt@simponic.xyz>2022-04-20 16:03:17 -0600
commit763ea5331b1977dd949c776215f2c7719f81ee9a (patch)
treec457c73fbf0f73a6d1975ece6d1573f4dfc6a26a /lib/aggiedit_web/live/post_live/show.ex
parent3cf9f4a364ac91cca30799c8379a682139425e71 (diff)
downloadaggiedit-763ea5331b1977dd949c776215f2c7719f81ee9a.tar.gz
aggiedit-763ea5331b1977dd949c776215f2c7719f81ee9a.zip
Initial chat box; man phoenix does not have the best docs
Diffstat (limited to 'lib/aggiedit_web/live/post_live/show.ex')
-rw-r--r--lib/aggiedit_web/live/post_live/show.ex6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/aggiedit_web/live/post_live/show.ex b/lib/aggiedit_web/live/post_live/show.ex
index 9d8f86c..69cd6c5 100644
--- a/lib/aggiedit_web/live/post_live/show.ex
+++ b/lib/aggiedit_web/live/post_live/show.ex
@@ -15,10 +15,10 @@ defmodule AggieditWeb.PostLive.Show do
post = Rooms.get_post!(id)
|> Repo.preload(:upload)
if Roles.guard?(socket.assigns.current_user, socket.assigns.live_action, post) do
- {:noreply,
- socket
+ socket = (if socket.assigns.live_action == :show, do: push_event(socket, "initial-post", %{:id => post.id}), else: socket)
|> assign(:page_title, page_title(socket.assigns.live_action))
- |> assign(:post, post)}
+ |> assign(:post, post)
+ {:noreply, socket}
else
{:noreply, socket |> put_flash(:error, "You don't have permission to do that.") |> redirect(to: Routes.post_show_path(socket, :show, socket.assigns.room, post))}
end