diff --git a/lib/music_library_web/live/artist_live/form.ex b/lib/music_library_web/live/artist_live/form.ex index a2218842..9c3fe2a7 100644 --- a/lib/music_library_web/live/artist_live/form.ex +++ b/lib/music_library_web/live/artist_live/form.ex @@ -265,10 +265,11 @@ defmodule MusicLibraryWeb.ArtistLive.Form do {:ok, artist_info} -> notify_parent({:saved, artist_info}) + put_toast!(:info, gettext("Artist image updated successfully")) + {:noreply, socket |> assign(:image_search_loading, false) - |> put_toast(:info, gettext("Artist image updated successfully")) |> push_patch(to: socket.assigns.patch)} {:error, _changeset} -> @@ -298,16 +299,15 @@ defmodule MusicLibraryWeb.ArtistLive.Form do {:ok, artist_info} <- Artists.update_artist_info(socket.assigns.artist_info, params) do notify_parent({:saved, artist_info}) - {:noreply, - socket - |> put_toast(:info, gettext("Artist updated successfully")) - |> push_patch(to: socket.assigns.patch)} + put_toast!(:info, gettext("Artist updated successfully")) + {:noreply, push_patch(socket, to: socket.assigns.patch)} else {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} {:error, _reason} -> - {:noreply, put_toast(socket, :error, gettext("Failed to store artist image"))} + put_toast!(:error, gettext("Failed to store artist image")) + {:noreply, socket} end end diff --git a/lib/music_library_web/live/online_store_template_live/form.ex b/lib/music_library_web/live/online_store_template_live/form.ex index 28e9a82d..e7921501 100644 --- a/lib/music_library_web/live/online_store_template_live/form.ex +++ b/lib/music_library_web/live/online_store_template_live/form.ex @@ -116,10 +116,8 @@ defmodule MusicLibraryWeb.OnlineStoreTemplateLive.Form do {:ok, template} -> notify_parent({:saved, template}) - {:noreply, - socket - |> put_toast(:info, gettext("Online store template updated successfully")) - |> push_patch(to: socket.assigns.patch)} + put_toast!(:info, gettext("Online store template updated successfully")) + {:noreply, push_patch(socket, to: socket.assigns.patch)} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} @@ -131,10 +129,8 @@ defmodule MusicLibraryWeb.OnlineStoreTemplateLive.Form do {:ok, template} -> notify_parent({:saved, template}) - {:noreply, - socket - |> put_toast(:info, gettext("Online store template created successfully")) - |> push_patch(to: socket.assigns.patch)} + put_toast!(:info, gettext("Online store template created successfully")) + {:noreply, push_patch(socket, to: socket.assigns.patch)} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} diff --git a/lib/music_library_web/live/scrobble_rules_live/form.ex b/lib/music_library_web/live/scrobble_rules_live/form.ex index 7891bc58..f1b333f9 100644 --- a/lib/music_library_web/live/scrobble_rules_live/form.ex +++ b/lib/music_library_web/live/scrobble_rules_live/form.ex @@ -92,10 +92,8 @@ defmodule MusicLibraryWeb.ScrobbleRulesLive.Form do {:ok, scrobble_rule} -> notify_parent({:updated, scrobble_rule}) - {:noreply, - socket - |> put_toast(:info, gettext("Scrobble rule updated successfully")) - |> push_patch(to: socket.assigns.patch)} + put_toast!(:info, gettext("Scrobble rule updated successfully")) + {:noreply, push_patch(socket, to: socket.assigns.patch)} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} @@ -107,10 +105,8 @@ defmodule MusicLibraryWeb.ScrobbleRulesLive.Form do {:ok, scrobble_rule} -> notify_parent({:created, scrobble_rule}) - {:noreply, - socket - |> put_toast(:info, gettext("Scrobble rule created successfully")) - |> push_patch(to: socket.assigns.patch)} + put_toast!(:info, gettext("Scrobble rule created successfully")) + {:noreply, push_patch(socket, to: socket.assigns.patch)} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} diff --git a/lib/music_library_web/live/scrobbled_tracks_live/form.ex b/lib/music_library_web/live/scrobbled_tracks_live/form.ex index 796e4a7c..b9818b93 100644 --- a/lib/music_library_web/live/scrobbled_tracks_live/form.ex +++ b/lib/music_library_web/live/scrobbled_tracks_live/form.ex @@ -108,10 +108,8 @@ defmodule MusicLibraryWeb.ScrobbledTracksLive.Form do {:ok, track} -> notify_parent({:saved, track}) - {:noreply, - socket - |> put_toast(:info, gettext("Track updated successfully")) - |> push_patch(to: socket.assigns.patch)} + put_toast!(:info, gettext("Track updated successfully")) + {:noreply, push_patch(socket, to: socket.assigns.patch)} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} diff --git a/test/music_library_web/live/scrobble_rules_live/index_test.exs b/test/music_library_web/live/scrobble_rules_live/index_test.exs index 85b303a4..7d996c2a 100644 --- a/test/music_library_web/live/scrobble_rules_live/index_test.exs +++ b/test/music_library_web/live/scrobble_rules_live/index_test.exs @@ -72,11 +72,11 @@ defmodule MusicLibraryWeb.ScrobbleRulesLiveTest do |> form("#scrobble_rule-form", scrobble_rule: @invalid_attrs) |> render_change() =~ "can't be blank" - html = - index_live - |> form("#scrobble_rule-form", scrobble_rule: @update_attrs) - |> render_submit() + index_live + |> form("#scrobble_rule-form", scrobble_rule: @update_attrs) + |> render_submit() + html = render(index_live) assert html =~ "Scrobble rule updated successfully" assert html =~ "some updated match_value" end