use EmailView function for greeting user and change layout email signature

pull/2431/head
Robert 4 years ago
parent 92df3b2577
commit f9fc0a741e

@ -1,18 +1,11 @@
<%= case Map.get(assigns, :user) do
%{name: name} when is_binary(name) -> "Hey #{String.split(name) |> List.first()},"
_any -> "Hey,"
end %>
<%= PlausibleWeb.EmailView.greet_recipient(assigns) %>
<br /><br />
<%= @inner_content %>
<br /><br />
Thanks,<br />
<%= if Application.get_env(:plausible, :is_selfhost) do %>
Plausible
<% else %>
Uku and Marko
<% end %>
Regards,<br />
The Plausible Team 💌
<br /><br />
--

@ -13,14 +13,12 @@ defmodule PlausibleWeb.EmailView do
PlausibleWeb.Endpoint.host()
end
def user_salutation(user) do
if user.name do
String.split(user.name) |> List.first()
else
""
end
def greet_recipient(%{user: %{name: name}}) when is_binary(name) do
"Hey #{String.split(name) |> List.first()},"
end
def greet_recipient(_), do: "Hey,"
def date_format(date) do
Timex.format!(date, "{D} {Mshort} {YYYY}")
end

Loading…
Cancel
Save