mirror of
https://git.rape.pet/ulith/amputoma.git
synced 2025-02-25 06:03:59 +01:00
14 lines
407 B
Elixir
14 lines
407 B
Elixir
defmodule Pleroma.Web.ChatChannel do
|
|
use Phoenix.Channel
|
|
|
|
def join("chat:public", _message, socket) do
|
|
{:ok, socket}
|
|
end
|
|
|
|
def handle_in("new_msg", %{"text" => text}, socket) do
|
|
author = socket.assigns[:user]
|
|
author = Pleroma.Web.MastodonAPI.AccountView.render("account.json", user: author)
|
|
broadcast! socket, "new_msg", %{text: text, author: author}
|
|
{:noreply, socket}
|
|
end
|
|
end
|