mailer now returns a tuple

This commit is contained in:
Luna D 2023-02-19 17:26:09 +01:00
parent 128fd1e970
commit d03375c604
No known key found for this signature in database
GPG key ID: 4B1C63448394F688
2 changed files with 23 additions and 25 deletions

View file

@ -3,16 +3,13 @@ defmodule Philomena.Users.UserNotifier do
alias Philomena.Mailer alias Philomena.Mailer
defp deliver(to, subject, body) do defp deliver(to, subject, body) do
email = Email.new_email(
Email.new_email( to: to,
to: to, from: mailer_address(),
from: mailer_address(), subject: subject,
subject: subject, text_body: body
text_body: body )
) |> Mailer.deliver_later()
|> Mailer.deliver_later()
{:ok, email}
end end
defp mailer_address do defp mailer_address do

View file

@ -200,28 +200,29 @@ defmodule PhilomenaWeb.AppView do
input_opts = Keyword.get(opts, :input_opts, []) input_opts = Keyword.get(opts, :input_opts, [])
label_opts = Keyword.get(opts, :label_opts, []) label_opts = Keyword.get(opts, :label_opts, [])
mapper = Keyword.get(opts, :mapper, &mapper_unwrapped/6) mapper = Keyword.get(opts, :mapper, &mapper_unwrapped/6)
wrapper = Keyword.get(opts, :wrapper, &(&1)) wrapper = Keyword.get(opts, :wrapper, & &1)
inputs = Enum.map(collection, fn {label_content, value} -> inputs =
id = input_id(form, field) <> "_#{value}" Enum.map(collection, fn {label_content, value} ->
id = input_id(form, field) <> "_#{value}"
input_opts = input_opts =
input_opts input_opts
|> Keyword.put(:type, "checkbox") |> Keyword.put(:type, "checkbox")
|> Keyword.put(:id, id) |> Keyword.put(:id, id)
|> Keyword.put(:name, name) |> Keyword.put(:name, name)
|> Keyword.put(:value, "#{value}") |> Keyword.put(:value, "#{value}")
|> put_selected(selected, value) |> put_selected(selected, value)
label_opts = label_opts ++ [for: id] label_opts = label_opts ++ [for: id]
mapper.(form, field, input_opts, label_content, label_opts, opts) mapper.(form, field, input_opts, label_content, label_opts, opts)
|> wrapper.() |> wrapper.()
end) end)
html_escape( html_escape(
inputs ++ inputs ++
hidden_input(form, field, [name: name, value: ""]) hidden_input(form, field, name: name, value: "")
) )
end end