   end
 
   defp notify_user(nil, _, _), do: nil
+
   defp notify_user(current_user, {status, message}, podcast) do
     notification = build_notification(podcast, {status, message}, current_user)
     Endpoint.broadcast("mailboxes:#{current_user.id}", "notification", notification)

  def import_new_episodes(podcast, current_user \\ nil) do
    with {:ok, _podcast} <- set_next_update(podcast),
         {:ok, feed} <- Feed.get_by_podcast_id(podcast.id),
         {:ok, map} <- RssFeed.import_to_map(feed.self_link_url, podcast.id, true), # do check for changes!
         {:ok, _} <- Persistor.delta_import(map, podcast.id),
         {:ok, _} <- unpause_and_reset_failure_count(podcast) do
      notify_user(current_user, {:ok, "imported"}, podcast)

      {:redirect, redirect_target} ->
        Feed.update_with_redirect_target(podcast.id, H.to_255(redirect_target))
        import_new_episodes(podcast, current_user)

      {:error, :not_found} ->
        increase_failure_count(podcast)
        message = "=== Podcast #{podcast.id} has no feed! ==="
        Logger.error(message)
        notify_user(current_user, {:error, message}, podcast)

      {:error, message} ->
        increase_failure_count(podcast)
        notify_user(current_user, {:error, message}, podcast)

      {:done, "nothing to do"} ->
        nil
    end
