diff --git a/lib/ex338_web/controllers/commish_email_controller.ex b/lib/ex338_web/controllers/commish_email_controller.ex
index 510cb4e7..f8adb394 100644
--- a/lib/ex338_web/controllers/commish_email_controller.ex
+++ b/lib/ex338_web/controllers/commish_email_controller.ex
@@ -3,7 +3,7 @@ defmodule Ex338Web.CommishEmailController do
alias Ex338.FantasyLeagues.FantasyLeague
alias Ex338.Repo
- alias Ex338Web.CommishEmail
+ alias Ex338Web.CommishNotifier
def new(conn, _params) do
render(
@@ -17,7 +17,7 @@ defmodule Ex338Web.CommishEmailController do
def create(conn, %{
"commish_email" => %{"leagues" => leagues, "subject" => subject, "message" => message}
}) do
- result = CommishEmail.send_email_to_leagues(leagues, subject, message)
+ result = CommishNotifier.send_email_to_leagues(leagues, subject, message)
case result do
{:ok, _result} ->
diff --git a/lib/ex338_web/controllers/trade_controller.ex b/lib/ex338_web/controllers/trade_controller.ex
index 67a011a0..2e41551f 100644
--- a/lib/ex338_web/controllers/trade_controller.ex
+++ b/lib/ex338_web/controllers/trade_controller.ex
@@ -9,8 +9,7 @@ defmodule Ex338Web.TradeController do
alias Ex338.FantasyTeams
alias Ex338.Trades
alias Ex338Web.Authorization
- alias Ex338Web.Mailer
- alias Ex338Web.TradeEmail
+ alias Ex338Web.TradeNotifier
plug(
:load_and_authorize_resource,
@@ -70,10 +69,7 @@ defmodule Ex338Web.TradeController do
admin_emails = Accounts.get_admin_emails()
recipients = Enum.uniq(Trades.Trade.get_teams_emails(trade) ++ admin_emails)
- conn
- |> TradeEmail.propose(league, trade, recipients)
- |> Mailer.deliver()
- |> Mailer.handle_delivery()
+ TradeNotifier.propose(league, trade, recipients)
conn
|> put_flash(:info, "Trade submitted for approval.")
@@ -106,10 +102,7 @@ defmodule Ex338Web.TradeController do
admin_emails = Accounts.get_admin_emails()
recipients = Enum.uniq(Trades.Trade.get_teams_emails(trade) ++ admin_emails)
- conn
- |> TradeEmail.cancel(league, trade, recipients, team)
- |> Mailer.deliver()
- |> Mailer.handle_delivery()
+ TradeNotifier.cancel(league, trade, recipients, team)
end
conn
diff --git a/lib/ex338_web/controllers/trade_vote_controller.ex b/lib/ex338_web/controllers/trade_vote_controller.ex
index d5f7889a..fd2352c6 100644
--- a/lib/ex338_web/controllers/trade_vote_controller.ex
+++ b/lib/ex338_web/controllers/trade_vote_controller.ex
@@ -7,8 +7,7 @@ defmodule Ex338Web.TradeVoteController do
alias Ex338.FantasyTeams.FantasyTeam
alias Ex338.Trades
alias Ex338Web.Authorization
- alias Ex338Web.Mailer
- alias Ex338Web.TradeEmail
+ alias Ex338Web.TradeNotifier
plug(
:load_and_authorize_resource,
@@ -35,7 +34,7 @@ defmodule Ex338Web.TradeVoteController do
if trade.status == "Proposed" do
trade
|> Trades.maybe_update_for_league_vote()
- |> maybe_send_trade_email(conn, team)
+ |> maybe_send_trade_email(team)
end
conn
@@ -53,28 +52,22 @@ defmodule Ex338Web.TradeVoteController do
# create
- defp maybe_send_trade_email(%{status: "Rejected"} = trade, conn, team) do
+ defp maybe_send_trade_email(%{status: "Rejected"} = trade, team) do
league = trade.submitted_by_team.fantasy_league
admin_emails = Accounts.get_admin_emails()
recipients = Enum.uniq(Trades.Trade.get_teams_emails(trade) ++ admin_emails)
- conn
- |> TradeEmail.reject(league, trade, recipients, team)
- |> Mailer.deliver()
- |> Mailer.handle_delivery()
+ TradeNotifier.reject(league, trade, recipients, team)
end
- defp maybe_send_trade_email(%{status: "Pending"} = trade, conn, _team) do
+ defp maybe_send_trade_email(%{status: "Pending"} = trade, _team) do
league = trade.submitted_by_team.fantasy_league
recipients = Accounts.get_league_and_admin_emails(league.id)
- conn
- |> TradeEmail.pending(league, trade, recipients)
- |> Mailer.deliver()
- |> Mailer.handle_delivery()
+ TradeNotifier.pending(league, trade, recipients)
end
- defp maybe_send_trade_email(trade, _conn, _team), do: trade
+ defp maybe_send_trade_email(trade, _team), do: trade
defp parse_errors(errors) do
case Keyword.get(errors, :trade) do
diff --git a/lib/ex338_web/emails/trade_email.ex b/lib/ex338_web/emails/trade_email.ex
deleted file mode 100644
index 0588720d..00000000
--- a/lib/ex338_web/emails/trade_email.ex
+++ /dev/null
@@ -1,49 +0,0 @@
-defmodule Ex338Web.TradeEmail do
- @moduledoc false
-
- use Phoenix.Swoosh, view: Ex338Web.EmailView, layout: {Ex338Web.LayoutView, :email}
-
- alias Ex338Web.Mailer
-
- def cancel(conn, league, trade, recipients, fantasy_team) do
- new()
- |> to(recipients)
- |> from(Mailer.default_from_name_and_email())
- |> subject("#{fantasy_team.team_name} canceled its proposed 338 trade")
- |> render_body("canceled_trade.html", %{
- conn: conn,
- fantasy_team: fantasy_team,
- league: league,
- trade: trade
- })
- end
-
- def pending(conn, league, trade, recipients) do
- new()
- |> to(recipients)
- |> from(Mailer.default_from_name_and_email())
- |> subject("New 338 #{league.fantasy_league_name} Trade for Approval")
- |> render_body("pending_trade.html", %{conn: conn, league: league, trade: trade})
- end
-
- def propose(conn, league, trade, recipients) do
- new()
- |> to(recipients)
- |> from(Mailer.default_from_name_and_email())
- |> subject("#{trade.submitted_by_team.team_name} proposed a 338 trade")
- |> render_body("proposed_trade.html", %{conn: conn, league: league, trade: trade})
- end
-
- def reject(conn, league, trade, recipients, fantasy_team) do
- new()
- |> to(recipients)
- |> from(Mailer.default_from_name_and_email())
- |> subject("Proposed trade rejected by #{fantasy_team.team_name}")
- |> render_body("rejected_trade.html", %{
- conn: conn,
- fantasy_team: fantasy_team,
- league: league,
- trade: trade
- })
- end
-end
diff --git a/lib/ex338_web/mailer.ex b/lib/ex338_web/mailer.ex
index c5671706..944a7581 100644
--- a/lib/ex338_web/mailer.ex
+++ b/lib/ex338_web/mailer.ex
@@ -31,7 +31,7 @@ defmodule Ex338Web.Mailer do
Logger.info("Sent email notification")
{:ok, email}
- {:error, reason} ->
+ {:error, {_, reason}} ->
Logger.warning("Sending email failed: #{inspect(reason)}")
{:error, reason}
end
diff --git a/lib/ex338_web/emails/commish_email.ex b/lib/ex338_web/notifiers/commish_notifier.ex
similarity index 91%
rename from lib/ex338_web/emails/commish_email.ex
rename to lib/ex338_web/notifiers/commish_notifier.ex
index c3ab128d..450b02ee 100644
--- a/lib/ex338_web/emails/commish_email.ex
+++ b/lib/ex338_web/notifiers/commish_notifier.ex
@@ -1,10 +1,11 @@
-defmodule Ex338Web.CommishEmail do
+defmodule Ex338Web.CommishNotifier do
@moduledoc false
+
alias Ex338.Accounts.User
alias Ex338.FantasyTeams
alias Ex338.Repo
- alias Ex338Web.EmailTemplate
alias Ex338Web.Mailer
+ alias Ex338Web.NotifierTemplate
def send_email_to_leagues(leagues, subject, message) do
owners = FantasyTeams.get_leagues_email_addresses(leagues)
@@ -24,7 +25,7 @@ defmodule Ex338Web.CommishEmail do
|> Enum.map(fn recipients ->
email_info
|> Map.put(:bcc, recipients)
- |> EmailTemplate.plain_text()
+ |> NotifierTemplate.plain_text()
|> Mailer.deliver()
|> Mailer.handle_delivery()
end)
diff --git a/lib/ex338_web/emails/email_template.ex b/lib/ex338_web/notifiers/notifier_template.ex
similarity index 84%
rename from lib/ex338_web/emails/email_template.ex
rename to lib/ex338_web/notifiers/notifier_template.ex
index 0e404925..d6cc6e19 100644
--- a/lib/ex338_web/emails/email_template.ex
+++ b/lib/ex338_web/notifiers/notifier_template.ex
@@ -1,4 +1,4 @@
-defmodule Ex338Web.EmailTemplate do
+defmodule Ex338Web.NotifierTemplate do
@moduledoc false
import Swoosh.Email
diff --git a/lib/ex338_web/notifiers/trade_notifier.ex b/lib/ex338_web/notifiers/trade_notifier.ex
new file mode 100644
index 00000000..aa9a675f
--- /dev/null
+++ b/lib/ex338_web/notifiers/trade_notifier.ex
@@ -0,0 +1,149 @@
+defmodule Ex338Web.TradeNotifier do
+ @moduledoc false
+ use Ex338Web, :html
+
+ alias Ex338Web.Mailer
+
+ def cancel(league, trade, recipients, fantasy_team) do
+ subject = "#{fantasy_team.team_name} canceled its proposed 338 trade"
+ assigns = %{fantasy_team: fantasy_team, league: league, trade: trade}
+
+ email_body = ~H"""
+
<%= @fantasy_team.team_name %> canceled its proposed trade
+ <.trade_table trade={@trade} />
+ Additional Terms:
+
+ <%= if @trade.additional_terms do %>
+ <%= @trade.additional_terms %>
+ <% else %>
+ None
+ <% end %>
+
+ ...
+ """
+
+ Mailer.build_and_deliver(recipients, subject, email_body)
+ end
+
+ def pending(league, trade, recipients) do
+ subject = "New 338 #{league.fantasy_league_name} Trade for Approval"
+ assigns = %{league: league, trade: trade}
+
+ email_body = ~H"""
+ The following trade is submitted for <%= @league.fantasy_league_name %> League approval:
+ <.trade_table trade={@trade} />
+ Additional Terms:
+
+ <%= if @trade.additional_terms do %>
+ <%= @trade.additional_terms %>
+ <% else %>
+ None
+ <% end %>
+
+
+
+ There will be a 3-day voting period for the league to approve the trade. A
+ no-response during the voting period will be considered an approval.
+
+
+ Please go to the
+ <.link href={url(~p"/fantasy_leagues/#{@league.id}/trades")}>list of trades
+ to place your vote.
+
+ ...
+ """
+
+ Mailer.build_and_deliver(recipients, subject, email_body)
+ end
+
+ def propose(league, trade, recipients) do
+ subject = "#{trade.submitted_by_team.team_name} proposed a 338 trade"
+ assigns = %{league: league, trade: trade}
+
+ email_body = ~H"""
+ <%= @trade.submitted_by_team.team_name %> proposed the following trade:
+ <.trade_table trade={@trade} />
+ Additional Terms:
+
+ <%= if @trade.additional_terms do %>
+ <%= @trade.additional_terms %>
+ <% else %>
+ None
+ <% end %>
+
+
+ Instructions to Accept or Reject the proposed trade:
+
+ All participating teams must accept the trade before it is submitted to the league for approval. A "yes" vote will accept
+ the trade on behalf of your team. A "no" vote will reject the trade on behalf of your team.
+
+
+ Please go to the
+ <.link href={url(~p"/fantasy_leagues/#{@league.id}/trades")}>list of proposed trades
+ to accept or reject the trade.
+
+ ...
+ """
+
+ Mailer.build_and_deliver(recipients, subject, email_body)
+ end
+
+ def reject(league, trade, recipients, fantasy_team) do
+ subject = "Proposed trade rejected by #{fantasy_team.team_name}"
+ assigns = %{fantasy_team: fantasy_team, league: league, trade: trade}
+
+ email_body = ~H"""
+
+ <%= @fantasy_team.team_name %> rejected the trade proposed by <%= @trade.submitted_by_team.team_name %>
+
+ <.trade_table trade={@trade} />
+ Additional Terms:
+
+ <%= if @trade.additional_terms do %>
+ <%= @trade.additional_terms %>
+ <% else %>
+ None
+ <% end %>
+
+ ...
+ """
+
+ Mailer.build_and_deliver(recipients, subject, email_body)
+ end
+
+ defp trade_table(assigns) do
+ ~H"""
+
+
+
+ Gaining Team |
+ Fantasy Player/Future Pick |
+ Losing Team |
+
+
+
+ <%= for line_item <- @trade.trade_line_items do %>
+
+
+ <%= line_item.gaining_team.team_name %>
+ |
+
+ <%= if(line_item.fantasy_player) do %>
+ <%= display_player(line_item.fantasy_player) %>
+ <% else %>
+ <%= display_future_pick(line_item.future_pick) %>
+ <% end %>
+ |
+
+ <%= line_item.losing_team.team_name %>
+ |
+
+ <% end %>
+
+
+ """
+ end
+
+ def display_player(%{player_name: name, sports_league: %{abbrev: abbrev}}),
+ do: "#{String.trim(name)}, #{abbrev}"
+end
diff --git a/lib/ex338_web/templates/email/canceled_trade.html.eex b/lib/ex338_web/templates/email/canceled_trade.html.eex
deleted file mode 100644
index e0038cb1..00000000
--- a/lib/ex338_web/templates/email/canceled_trade.html.eex
+++ /dev/null
@@ -1,10 +0,0 @@
-<%= @fantasy_team.team_name %> canceled its proposed trade
-<%= render "trade_table.html", trade: @trade %>
-Additional Terms:
-
- <%= if @trade.additional_terms do %>
- <%= @trade.additional_terms %>
- <% else %>
- None
- <% end %>
-
diff --git a/lib/ex338_web/templates/email/pending_trade.html.eex b/lib/ex338_web/templates/email/pending_trade.html.eex
deleted file mode 100644
index 11146114..00000000
--- a/lib/ex338_web/templates/email/pending_trade.html.eex
+++ /dev/null
@@ -1,18 +0,0 @@
-The following trade is submitted for <%= @league.fantasy_league_name %> League approval:
-<%= render "trade_table.html", trade: @trade %>
-Additional Terms:
-
- <%= if @trade.additional_terms do %>
- <%= @trade.additional_terms %>
- <% else %>
- None
- <% end %>
-
-
-
- There will be a 3-day voting period for the league to approve the trade. A
- no-response during the voting period will be considered an approval.
-
-
- Please go to the <%= link "list of trades", to: url(~p"/fantasy_leagues/#{@league.id}/trades") %> to place your vote.
-
diff --git a/lib/ex338_web/templates/email/proposed_trade.html.eex b/lib/ex338_web/templates/email/proposed_trade.html.eex
deleted file mode 100644
index 125bdad6..00000000
--- a/lib/ex338_web/templates/email/proposed_trade.html.eex
+++ /dev/null
@@ -1,19 +0,0 @@
-<%= @trade.submitted_by_team.team_name %> proposed the following trade:
-<%= render "trade_table.html", trade: @trade %>
-Additional Terms:
-
- <%= if @trade.additional_terms do %>
- <%= @trade.additional_terms %>
- <% else %>
- None
- <% end %>
-
-
-Instructions to Accept or Reject the proposed trade:
-
- All participating teams must accept the trade before it is submitted to the league for approval. A "yes" vote will accept
- the trade on behalf of your team. A "no" vote will reject the trade on behalf of your team.
-
-
- Please go to the <%= link "list of proposed trades", to: url(~p"/fantasy_leagues/#{@league.id}/trades") %> to accept or reject the trade.
-
diff --git a/lib/ex338_web/templates/email/rejected_trade.html.eex b/lib/ex338_web/templates/email/rejected_trade.html.eex
deleted file mode 100644
index 8bd9e856..00000000
--- a/lib/ex338_web/templates/email/rejected_trade.html.eex
+++ /dev/null
@@ -1,10 +0,0 @@
-<%= @fantasy_team.team_name %> rejected the trade proposed by <%= @trade.submitted_by_team.team_name %>
-<%= render "trade_table.html", trade: @trade %>
-Additional Terms:
-
- <%= if @trade.additional_terms do %>
- <%= @trade.additional_terms %>
- <% else %>
- None
- <% end %>
-
diff --git a/lib/ex338_web/templates/email/trade_table.html.eex b/lib/ex338_web/templates/email/trade_table.html.eex
deleted file mode 100644
index f5eddec8..00000000
--- a/lib/ex338_web/templates/email/trade_table.html.eex
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Gaining Team |
- Fantasy Player/Future Pick |
- Losing Team |
-
-
-
- <%= for line_item <- @trade.trade_line_items do %>
-
-
- <%= line_item.gaining_team.team_name %>
- |
-
- <%= if(line_item.fantasy_player) do %>
- <%= display_player(line_item.fantasy_player) %>
- <% else %>
- <%= display_future_pick(line_item.future_pick) %>
- <% end %>
- |
-
- <%= line_item.losing_team.team_name %>
- |
-
- <% end %>
-
-
diff --git a/lib/ex338_web/views/email_view.ex b/lib/ex338_web/views/email_view.ex
deleted file mode 100644
index b64e1bbf..00000000
--- a/lib/ex338_web/views/email_view.ex
+++ /dev/null
@@ -1,6 +0,0 @@
-defmodule Ex338Web.EmailView do
- use Ex338Web, :view
-
- def display_player(%{player_name: name, sports_league: %{abbrev: abbrev}}),
- do: "#{String.trim(name)}, #{abbrev}"
-end
diff --git a/mix.exs b/mix.exs
index 386c5303..dae1be10 100644
--- a/mix.exs
+++ b/mix.exs
@@ -72,7 +72,6 @@ defmodule Ex338.Mixfile do
{:phoenix_pubsub_redis, "~> 3.0.0"},
{:phoenix_live_view, "~> 0.20.7"},
{:phoenix_view, "~> 2.0"},
- {:phoenix_swoosh, "~> 1.2.0"},
{:plug_cowboy, "~> 2.7"},
{:postgrex, "~> 0.17.4"},
{:pow, "== 1.0.36"},
diff --git a/mix.lock b/mix.lock
index 43f41743..c5a8ab82 100644
--- a/mix.lock
+++ b/mix.lock
@@ -6,7 +6,6 @@
"castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
"comeonin": {:hex, :comeonin, "5.4.0", "246a56ca3f41d404380fc6465650ddaa532c7f98be4bda1b4656b3a37cc13abe", [:mix], [], "hexpm", "796393a9e50d01999d56b7b8420ab0481a7538d0caf80919da493b4a6e51faf1"},
- "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
"cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"},
"cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"},
@@ -29,7 +28,6 @@
"hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"},
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized"]},
"honeybadger": {:hex, :honeybadger, "0.21.0", "a81f1db7807c3a250f3c4e81c1baa76b59c27974dafe0ff61b69232346e05060", [:mix], [{:ecto, ">= 2.0.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:hackney, "~> 1.1", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.0.0 and < 2.0.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, ">= 1.0.0 and < 2.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "444d7161e105ac2ee70e28c280cb3ad43d42f1d3d9670f2db21efffe9fbe6b0c"},
- "httpoison": {:hex, :httpoison, "1.5.1", "0f55b5b673b03c5c327dac7015a67cb571b99b631acc0bc1b0b98dcd6b9f2104", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "191a3b6329c917de4e7ca68431919a59bf19e60694b313a69bc1f56a4cb160bf"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"kaffy": {:hex, :kaffy, "0.10.2", "72e807c525323bd0cbc3ac0c127b7bde61caffdc576fb6554964d3fe6a2a6100", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0.2", [hex: :phoenix_view, repo: "hexpm", optional: false]}], "hexpm", "651cad5f3bcc91510a671c13c7a273b8b8195fdf2d809208708baecbb77300bf"},
@@ -37,7 +35,6 @@
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
- "mixpanel_api_ex": {:hex, :mixpanel_api_ex, "1.2.3", "918fae2ec8978cf962e8a1b92291bcf3e9e8f590a053999d240e0a05fed876d3", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "94fc106ca326d1581f69058b8a018f4eb3d6d8ff444c47ad947f0f817128a55f"},
"nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"nimble_publisher": {:hex, :nimble_publisher, "1.1.0", "49dee0f30536140268996660a5927d0282946949c35c88ccc6da11a19231b4b6", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "80fb42d8d1e34f41ff29fc2a1ae6ab86ea7b764b3c2d38e5268a43cf33825782"},
@@ -52,13 +49,11 @@
"phoenix_live_view": {:hex, :phoenix_live_view, "0.20.9", "46d5d436d3f8ff97f066b6c45528fd842a711fd3875b2d3f706b2e769ea07c51", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "694388615ece21b70c523910cba1c633132b08a270caaf60100dd4eaf331885d"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"},
"phoenix_pubsub_redis": {:hex, :phoenix_pubsub_redis, "3.0.1", "d4d856b1e57a21358e448543e1d091e07e83403dde4383b8be04ed9d2c201cbc", [:mix], [{:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5.1 or ~> 1.6", [hex: :poolboy, repo: "hexpm", optional: false]}, {:redix, "~> 0.10.0 or ~> 1.0", [hex: :redix, repo: "hexpm", optional: false]}], "hexpm", "0b36a17ff6e9a56159f8df8933d62b5c1f0695eae995a02e0c86c035ace6a309"},
- "phoenix_swoosh": {:hex, :phoenix_swoosh, "1.2.1", "b74ccaa8046fbc388a62134360ee7d9742d5a8ae74063f34eb050279de7a99e1", [:mix], [{:finch, "~> 0.8", [hex: :finch, repo: "hexpm", optional: true]}, {:hackney, "~> 1.10", [hex: :hackney, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:swoosh, "~> 1.5", [hex: :swoosh, repo: "hexpm", optional: false]}], "hexpm", "4000eeba3f9d7d1a6bf56d2bd56733d5cadf41a7f0d8ffe5bb67e7d667e204a2"},
"phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"},
"phoenix_view": {:hex, :phoenix_view, "2.0.3", "4d32c4817fce933693741deeb99ef1392619f942633dde834a5163124813aad3", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "cd34049af41be2c627df99cd4eaa71fc52a328c0c3d8e7d4aa28f880c30e7f64"},
"plug": {:hex, :plug, "1.15.3", "712976f504418f6dff0a3e554c40d705a9bcf89a7ccef92fc6a5ef8f16a30a97", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cc4365a3c010a56af402e0809208873d113e9c38c401cabd88027ef4f5c01fd2"},
"plug_cowboy": {:hex, :plug_cowboy, "2.7.0", "3ae9369c60641084363b08fe90267cbdd316df57e3557ea522114b30b63256ea", [:mix], [{:cowboy, "~> 2.7.0 or ~> 2.8.0 or ~> 2.9.0 or ~> 2.10.0", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d85444fb8aa1f2fc62eabe83bbe387d81510d773886774ebdcb429b3da3c1a4a"},
"plug_crypto": {:hex, :plug_crypto, "2.0.0", "77515cc10af06645abbfb5e6ad7a3e9714f805ae118fa1a70205f80d2d70fe73", [:mix], [], "hexpm", "53695bae57cc4e54566d993eb01074e4d894b65a3766f1c43e2c61a1b0f45ea9"},
- "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"},
"poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"},
"postgrex": {:hex, :postgrex, "0.17.4", "5777781f80f53b7c431a001c8dad83ee167bcebcf3a793e3906efff680ab62b3", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "6458f7d5b70652bc81c3ea759f91736c16a31be000f306d3c64bcdfe9a18b3cc"},
"pow": {:hex, :pow, "1.0.36", "d4bb8d8f58b325cd198a3f4ccfa37a0bfc2b7f1f6c3fa2f2e08a7d96604a660f", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.3.0 and < 1.8.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 2.0.0 and < 5.0.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, ">= 0.18.0", [hex: :phoenix_live_view, repo: "hexpm", optional: true]}, {:plug, ">= 1.5.0 and < 2.0.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "5b9695940b9a5beaf8c017b550e1ed5c9ece7e36fb8df447e8eff9967544cf77"},
diff --git a/test/ex338/commish_email_test.exs b/test/ex338/commish_notifier_test.exs
similarity index 78%
rename from test/ex338/commish_email_test.exs
rename to test/ex338/commish_notifier_test.exs
index b0584b26..9ebf064a 100644
--- a/test/ex338/commish_email_test.exs
+++ b/test/ex338/commish_notifier_test.exs
@@ -1,10 +1,10 @@
-defmodule Ex338.CommishEmailTest do
+defmodule Ex338.CommishNotifierTest do
use Ex338.DataCase, async: true
import Swoosh.TestAssertions
- alias Ex338Web.CommishEmail
- alias Ex338Web.EmailTemplate
+ alias Ex338Web.CommishNotifier
+ alias Ex338Web.NotifierTemplate
describe "send_email_to_leagues/3" do
test "sends an email to owners of a list of leagues" do
@@ -24,13 +24,13 @@ defmodule Ex338.CommishEmailTest do
message: message
}
- CommishEmail.send_email_to_leagues(
+ CommishNotifier.send_email_to_leagues(
[league.id],
subject,
message
)
- assert_email_sent(EmailTemplate.plain_text(email_info))
+ assert_email_sent(NotifierTemplate.plain_text(email_info))
end
end
@@ -39,7 +39,7 @@ defmodule Ex338.CommishEmailTest do
admins = [{"Ryan", "ryan@example.com"}]
owners = [{"owner", "owner@example.com"}]
- result = CommishEmail.unique_recipients(owners, admins)
+ result = CommishNotifier.unique_recipients(owners, admins)
assert result == owners ++ admins
end
@@ -49,7 +49,7 @@ defmodule Ex338.CommishEmailTest do
owners = [brown, {"owner", "owner@example.com"}]
admins = [brown]
- result = CommishEmail.unique_recipients(owners, admins)
+ result = CommishNotifier.unique_recipients(owners, admins)
assert result == owners
end
diff --git a/test/ex338_web/controllers/commish_email_controller_test.exs b/test/ex338_web/controllers/commish_email_controller_test.exs
index d2686fce..c2f60447 100644
--- a/test/ex338_web/controllers/commish_email_controller_test.exs
+++ b/test/ex338_web/controllers/commish_email_controller_test.exs
@@ -4,7 +4,7 @@ defmodule Ex338Web.CommishEmailControllerTest do
import Swoosh.TestAssertions
alias Ex338.Accounts.User
- alias Ex338Web.EmailTemplate
+ alias Ex338Web.NotifierTemplate
setup %{conn: conn} do
user = %User{name: "test", email: "test@example.com", id: 1}
@@ -57,7 +57,7 @@ defmodule Ex338Web.CommishEmailControllerTest do
conn = post(conn, commish_email_path(conn, :create, commish_email: attrs))
assert html_response(conn, 302) =~ ~r/redirected/
- assert_email_sent(EmailTemplate.plain_text(email_info))
+ assert_email_sent(NotifierTemplate.plain_text(email_info))
end
test "redirects to root if user is not admin", %{conn: conn} do
diff --git a/test/ex338_web/views/email_view_test.exs b/test/ex338_web/views/email_view_test.exs
deleted file mode 100644
index 162e514f..00000000
--- a/test/ex338_web/views/email_view_test.exs
+++ /dev/null
@@ -1,18 +0,0 @@
-defmodule Ex338Web.EmailViewTest do
- use Ex338Web.ConnCase, async: true
-
- alias Ex338Web.EmailView
-
- describe "display_player/1" do
- test "returns trimmed player name and abbrev" do
- player = %{
- player_name: "Name ",
- sports_league: %{
- abbrev: "CBB"
- }
- }
-
- assert EmailView.display_player(player) == "Name, CBB"
- end
- end
-end