planning-poker/lib/planningpoker_web/channels/presence.ex

25 lines
624 B
Elixir
Raw Normal View History

2020-05-06 05:30:43 +00:00
defmodule PlanningpokerWeb.Presence do
@moduledoc """
Provides presence tracking to channels and processes.
See the [`Phoenix.Presence`](http://hexdocs.pm/phoenix/Phoenix.Presence.html)
docs for more details.
"""
use Phoenix.Presence, otp_app: :planningpoker,
pubsub_server: Planningpoker.PubSub
2020-05-08 03:43:02 +00:00
require Logger
alias Planningpoker.Db
def fetch(_topic, entries) do
users =
entries
|> Map.keys()
|> Db.get_users()
|> Enum.into(%{})
for {key, %{metas: metas}} <- entries, into: %{} do
{key, %{metas: metas, name: users[key]}}
end
end
2020-05-06 05:30:43 +00:00
end