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,11 +31,13 @@ defmodule LiveBeats.MediaLibrary do
|
|||
end
|
||||
|
||||
def broadcast_ping(%Accounts.User{} = user, rtt, region) do
|
||||
if user.active_profile_user_id do
|
||||
broadcast!(
|
||||
user.active_profile_user_id,
|
||||
{:ping, %{user: user, rtt: rtt, region: region}}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def unsubscribe_to_profile(%Profile{} = profile) do
|
||||
Phoenix.PubSub.unsubscribe(@pubsub, topic(profile.user_id))
|
||||
|
|
|
@ -102,13 +102,14 @@ defmodule LiveBeatsWeb.ProfileLive.UploadFormComponent do
|
|||
end
|
||||
|
||||
defp put_new_changeset(socket, entry) do
|
||||
if get_changeset(socket, entry.ref) do
|
||||
cond do
|
||||
get_changeset(socket, entry.ref) ->
|
||||
socket
|
||||
else
|
||||
if Enum.count(socket.assigns.changesets) > @max_songs do
|
||||
raise RuntimeError, "file upload limited exceeded"
|
||||
end
|
||||
|
||||
Enum.count(socket.assigns.changesets) > @max_songs ->
|
||||
socket
|
||||
|
||||
true ->
|
||||
attrs = MediaLibrary.parse_file_name(entry.client_name)
|
||||
changeset = MediaLibrary.change_song(%MediaLibrary.Song{}, attrs)
|
||||
|
||||
|
|
Loading…
Reference in a new issue