akkoma/lib/pleroma/web/streamer/streamer_socket.ex
Egor Kislitsyn 96816ceaa2 Revert "Merge branch 'revert-4fabf83a' into 'develop'"
This reverts commit fe7fd33126, reversing
changes made to 4fabf83ad0.
2019-09-16 17:55:04 +07:00

32 lines
653 B
Elixir

defmodule Pleroma.Web.Streamer.StreamerSocket do
defstruct transport_pid: nil, user: nil
alias Pleroma.User
alias Pleroma.Web.Streamer.StreamerSocket
def from_socket(%{
transport_pid: transport_pid,
assigns: %{user: nil}
}) do
%StreamerSocket{
transport_pid: transport_pid
}
end
def from_socket(%{
transport_pid: transport_pid,
assigns: %{user: %User{} = user}
}) do
%StreamerSocket{
transport_pid: transport_pid,
user: user
}
end
def from_socket(%{transport_pid: transport_pid}) do
%StreamerSocket{
transport_pid: transport_pid
}
end
end