mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-11-21 23:50:59 +00:00
Fix bugs
This commit is contained in:
parent
1975f85cfe
commit
d9b63adb85
2 changed files with 16 additions and 13 deletions
|
@ -31,10 +31,12 @@ defmodule LiveBeats.MediaLibrary do
|
||||||
end
|
end
|
||||||
|
|
||||||
def broadcast_ping(%Accounts.User{} = user, rtt, region) do
|
def broadcast_ping(%Accounts.User{} = user, rtt, region) do
|
||||||
broadcast!(
|
if user.active_profile_user_id do
|
||||||
user.active_profile_user_id,
|
broadcast!(
|
||||||
{:ping, %{user: user, rtt: rtt, region: region}}
|
user.active_profile_user_id,
|
||||||
)
|
{:ping, %{user: user, rtt: rtt, region: region}}
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def unsubscribe_to_profile(%Profile{} = profile) do
|
def unsubscribe_to_profile(%Profile{} = profile) do
|
||||||
|
|
|
@ -102,17 +102,18 @@ defmodule LiveBeatsWeb.ProfileLive.UploadFormComponent do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp put_new_changeset(socket, entry) do
|
defp put_new_changeset(socket, entry) do
|
||||||
if get_changeset(socket, entry.ref) do
|
cond do
|
||||||
socket
|
get_changeset(socket, entry.ref) ->
|
||||||
else
|
socket
|
||||||
if Enum.count(socket.assigns.changesets) > @max_songs do
|
|
||||||
raise RuntimeError, "file upload limited exceeded"
|
|
||||||
end
|
|
||||||
|
|
||||||
attrs = MediaLibrary.parse_file_name(entry.client_name)
|
Enum.count(socket.assigns.changesets) > @max_songs ->
|
||||||
changeset = MediaLibrary.change_song(%MediaLibrary.Song{}, attrs)
|
socket
|
||||||
|
|
||||||
update_changeset(socket, changeset, entry.ref)
|
true ->
|
||||||
|
attrs = MediaLibrary.parse_file_name(entry.client_name)
|
||||||
|
changeset = MediaLibrary.change_song(%MediaLibrary.Song{}, attrs)
|
||||||
|
|
||||||
|
update_changeset(socket, changeset, entry.ref)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue