diff --git a/config/runtime.exs b/config/runtime.exs index 76f2616..7704f4f 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -29,7 +29,6 @@ if config_env() == :prod do You can generate one by calling: mix phx.gen.secret """ - app_name = System.fetch_env!("FLY_APP_NAME") host = System.get_env("URL_HOST") || "example.com" config :live_beats, LiveBeatsWeb.Endpoint, diff --git a/fly.toml b/fly.toml index 5f07bf5..1fe5bc7 100644 --- a/fly.toml +++ b/fly.toml @@ -11,6 +11,10 @@ processes = [] IPV6 = 1 URL_HOST = "livebeats.fly.dev" +[mounts] + source="data" + destination="/app/live_beats/lib/live_beats-0.1.0/priv/uploads" + [experimental] allowed_public_ports = [] auto_rollback = true @@ -25,7 +29,7 @@ processes = [] [services.concurrency] hard_limit = 25 soft_limit = 20 - type = "connections" + type = "requests" [[services.ports]] handlers = ["http"] diff --git a/lib/live_beats/accounts.ex b/lib/live_beats/accounts.ex index 982f712..50efa35 100644 --- a/lib/live_beats/accounts.ex +++ b/lib/live_beats/accounts.ex @@ -21,6 +21,12 @@ defmodule LiveBeats.Accounts do Repo.all(from u in User, limit: ^Keyword.fetch!(opts, :limit)) end + def lists_users_by_active_profile(id, opts) do + Repo.all( + from u in User, where: u.active_profile_user_id == ^id, limit: ^Keyword.fetch!(opts, :limit) + ) + end + def admin?(%User{} = user) do user.email in Application.fetch_env!(:live_beats, :admin_emails) end @@ -76,6 +82,8 @@ defmodule LiveBeats.Accounts do """ def get_user!(id), do: Repo.get!(User, id) + def get_user(id), do: Repo.get(User, id) + def get_user_by!(fields), do: Repo.get_by!(User, fields) def update_active_profile(%User{active_profile_user_id: same_id} = current_user, same_id) do diff --git a/lib/live_beats_web/channels/presence.ex b/lib/live_beats_web/channels/presence.ex index 299464d..39ed342 100644 --- a/lib/live_beats_web/channels/presence.ex +++ b/lib/live_beats_web/channels/presence.ex @@ -15,7 +15,7 @@ defmodule LiveBeatsWeb.Presence do ~H"""
-

Who's Here

+

Who's Listening

<.link href={@profile.external_homepage_url} _target="blank" class="block text-sm text-gray-600"> - <.icon name={:code}/> <%= url_text(@profile.external_homepage_url) %> + <.icon name={:code}/> <%= url_text(@profile.external_homepage_url) %> @@ -40,7 +40,6 @@ defmodule LiveBeatsWeb.SongLive.Index do - <:abbrev let={user}><%= String.first(user.username) %> <:title let={user}><%= user.username %> @@ -231,8 +230,8 @@ defmodule LiveBeatsWeb.SongLive.Index do end defp assign_presences(socket) do - # TODO - assign(socket, presences: Accounts.list_users(limit: 10)) + users = Accounts.lists_users_by_active_profile(socket.assigns.profile.user_id, limit: 10) + assign(socket, presences: users) end defp url_text(nil), do: "" diff --git a/lib/live_beats_web/router.ex b/lib/live_beats_web/router.ex index 1db8141..b9d0e83 100644 --- a/lib/live_beats_web/router.ex +++ b/lib/live_beats_web/router.ex @@ -2,7 +2,7 @@ defmodule LiveBeatsWeb.Router do use LiveBeatsWeb, :router import LiveBeatsWeb.UserAuth, - only: [fetch_current_user: 2, redirect_if_user_is_authenticated: 2] + only: [redirect_if_user_is_authenticated: 2] pipeline :browser do plug :accepts, ["html"] @@ -11,7 +11,6 @@ defmodule LiveBeatsWeb.Router do plug :put_root_layout, {LiveBeatsWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers - plug :fetch_current_user end pipeline :api do diff --git a/lib/live_beats_web/templates/layout/live.html.heex b/lib/live_beats_web/templates/layout/live.html.heex index a8bdfd1..2e890b9 100644 --- a/lib/live_beats_web/templates/layout/live.html.heex +++ b/lib/live_beats_web/templates/layout/live.html.heex @@ -113,23 +113,25 @@ -
- -
-
- + <%= if @current_user do %> +
+ +
+
+ +
-
+ <% end %>