mirror of
https://github.com/plausible/analytics.git
synced 2024-12-29 04:22:34 +03:00
74675f0cbc
* Move dogfooding to `extra/` * Remove unused view functions
35 lines
776 B
Elixir
35 lines
776 B
Elixir
defmodule PlausibleWeb.EmailView do
|
|
use Plausible
|
|
use PlausibleWeb, :view
|
|
|
|
def plausible_url do
|
|
PlausibleWeb.Endpoint.url()
|
|
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
|
|
|
|
def sentry_link(trace_id, dsn \\ Sentry.Config.dsn()) do
|
|
search_query = URI.encode_query(%{query: trace_id})
|
|
path = "/organizations/sentry/issues/"
|
|
|
|
if is_binary(dsn) do
|
|
dsn
|
|
|> URI.parse()
|
|
|> Map.replace(:userinfo, nil)
|
|
|> Map.replace(:path, path)
|
|
|> Map.replace(:query, search_query)
|
|
|> URI.to_string()
|
|
else
|
|
""
|
|
end
|
|
end
|
|
end
|