diff --git a/lib/ret_web/channels/hub_channel.ex b/lib/ret_web/channels/hub_channel.ex index 1f5c2156c..25448d8ee 100644 --- a/lib/ret_web/channels/hub_channel.ex +++ b/lib/ret_web/channels/hub_channel.ex @@ -297,7 +297,15 @@ defmodule RetWeb.HubChannel do account = Guardian.Phoenix.Socket.current_resource(socket) hub = socket |> hub_for_socket - if (type != "photo" and type != "video") or account |> can?(spawn_camera(hub)) do + authorized = + cond do + type in ["photo", "video"] -> account |> can?(spawn_camera(hub)) + type === "chat" -> account |> can?(text_chat(hub)) + type === "permission" -> account |> can?(update_hub(hub)) + true -> true + end + + if authorized do broadcast!( socket, event,