diff --git a/lib/plausible/billing/quota.ex b/lib/plausible/billing/quota.ex index 569c73062..24b7406a2 100644 --- a/lib/plausible/billing/quota.ex +++ b/lib/plausible/billing/quota.ex @@ -36,9 +36,10 @@ defmodule Plausible.Billing.Quota do @limit_sites_since ~D[2021-05-05] @spec site_limit(User.t()) :: non_neg_integer() | :unlimited def site_limit(user) do - cond do - Timex.before?(user.inserted_at, @limit_sites_since) -> :unlimited - true -> get_site_limit_from_plan(user) + if Timex.before?(user.inserted_at, @limit_sites_since) do + :unlimited + else + get_site_limit_from_plan(user) end end diff --git a/lib/plausible_web/plugs/maybe_disable_registration.ex b/lib/plausible_web/plugs/maybe_disable_registration.ex index ef5ea888d..7c05a7b91 100644 --- a/lib/plausible_web/plugs/maybe_disable_registration.ex +++ b/lib/plausible_web/plugs/maybe_disable_registration.ex @@ -20,15 +20,13 @@ defmodule PlausibleWeb.Plugs.MaybeDisableRegistration do disable_registration = Keyword.fetch!(selfhost_config, :disable_registration) first_launch? = Release.should_be_first_launch?() - cond do - not first_launch? and disable_registration in disabled_for -> - conn - |> put_flash(:error, "Registration is disabled on this instance") - |> redirect(to: Routes.auth_path(conn, :login_form)) - |> halt() - - true -> - conn + if not first_launch? and disable_registration in disabled_for do + conn + |> put_flash(:error, "Registration is disabled on this instance") + |> redirect(to: Routes.auth_path(conn, :login_form)) + |> halt() + else + conn end end end diff --git a/lib/plausible_web/templates/error/server_error.html.heex b/lib/plausible_web/templates/error/server_error.html.heex index 0544c875a..24077e525 100644 --- a/lib/plausible_web/templates/error/server_error.html.heex +++ b/lib/plausible_web/templates/error/server_error.html.heex @@ -1,53 +1,73 @@
-
+

Oops, sorry about that...

-
-
-
- -
-
-

- There has been a server error. - <%= if full_build?() do %> - But don't worry, we're on it! - <% end %> -

+
+
+
+ +
+
+

+ There has been a server error. + <%= if full_build?() do %> + But don't worry, we're on it! + <% end %> +

-
-

+

+

<%= if assigns[:trace_id] && full_build?() do %> If you would like to help, tell us what you were trying to do. Our development team will receive your report. <% else %> We have been notified. <% end %> -

-
+

+
<%= if full_build?() do %> <%= if assigns[:trace_id] do %>
<%= form_for :error, Routes.error_report_path(PlausibleWeb.Endpoint, :submit_error_report), fn f -> %> - <%= hidden_input f, :trace_id, value: @trace_id %> - <%= label f, "What happened?", class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %> - <%= textarea f, :user_feedback, rows: 5, class: "block w-full max-w-xl border-gray-300 dark:border-gray-700 resize-none shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md dark:bg-gray-900 dark:text-gray-300", placeholder: "I clicked on 'X' and then hit 'Confirm'..." %> - <%= submit "Send feedback →", class: "button mt-4 w-full" %> + <%= hidden_input(f, :trace_id, value: @trace_id) %> + <%= label(f, "What happened?", + class: "block text-sm font-medium text-gray-700 dark:text-gray-300" + ) %> + <%= textarea(f, :user_feedback, + rows: 5, + class: + "block w-full max-w-xl border-gray-300 dark:border-gray-700 resize-none shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md dark:bg-gray-900 dark:text-gray-300", + placeholder: "I clicked on 'X' and then hit 'Confirm'..." + ) %> + <%= submit("Send feedback →", class: "button mt-4 w-full") %> <% end %>
<% end %>
-

- <%= link("Home page", to: "/", class: "text-indigo-500 mr-8") %> - <%= link("Status page", to: "https://status.plausible.io", class: "mr-8 text-indigo-500") %> - <%= link("Contact us", to: "https://plausible.io/contact", class: "text-indigo-500") %> -

+

+ <%= link("Home page", to: "/", class: "text-indigo-500 mr-8") %> + <%= link("Status page", + to: "https://status.plausible.io", + class: "mr-8 text-indigo-500" + ) %> + <%= link("Contact us", to: "https://plausible.io/contact", class: "text-indigo-500") %> +

<% end %>