Fix username not updating on presence when settings changed

This commit is contained in:
Chris McCord 2022-01-26 11:49:53 -05:00
parent 83db1294f9
commit 5ce9142253

View file

@ -249,6 +249,13 @@ defmodule LiveBeatsWeb.PlayerLive do
end
def handle_info({MediaLibrary, %MediaLibrary.Events.PublicProfileUpdated{} = update}, socket) do
%{current_user: current_user} = socket.assigns
if update.profile.user_id == socket.assigns.current_user.id do
LiveBeats.PresenceClient.untrack(socket.assigns.profile, current_user.id)
LiveBeats.PresenceClient.track(update.profile, current_user.id)
end
{:noreply, assign_profile(socket, update.profile)}
end