untrack user from presence when a new profile is chosen

This commit is contained in:
Berenice Medel 2022-02-02 14:48:11 -06:00
parent 6d39e774e6
commit e76742a27b

View file

@ -155,6 +155,10 @@ defmodule LiveBeatsWeb.PlayerLive do
if profile && connected?(socket) do
current_user = Accounts.update_active_profile(current_user, profile.user_id)
#untrack last profile the user was listening
if socket.assigns.profile do
LiveBeats.PresenceClient.untrack(socket.assigns.profile, current_user.id)
end
LiveBeats.PresenceClient.track(profile, current_user.id)
send(self(), :play_current)