Credo + format

pull/3559/head
Adam Rutkowski 3 years ago
parent 976178a7f3
commit 8adcfa8804

@ -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

@ -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

@ -1,53 +1,73 @@
<div class="w-full max-w-3xl mt-4 mx-auto flex">
<div class="max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-lg rounded px-8 pt-6 pb-8 mb-4 mt-8" >
<div class="max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-lg rounded px-8 pt-6 pb-8 mb-4 mt-8">
<h2 class="text-xl font-black dark:text-gray-100">Oops, sorry about that...</h2>
<div class="rounded-md bg-yellow-50 dark:bg-transparent dark:border border-yellow-200 p-4 mt-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-yellow-400 dark:text-yellow-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-400">
There has been a server error.
<%= if full_build?() do %>
But don't worry, we're on it!
<% end %>
</h3>
<div class="rounded-md bg-yellow-50 dark:bg-transparent dark:border border-yellow-200 p-4 mt-4">
<div class="flex">
<div class="flex-shrink-0">
<svg
class="h-5 w-5 text-yellow-400 dark:text-yellow-300"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z"
clip-rule="evenodd"
/>
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-400">
There has been a server error.
<%= if full_build?() do %>
But don't worry, we're on it!
<% end %>
</h3>
<div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300">
<p>
<div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300">
<p>
<%= 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 %>
</p>
</div>
</p>
</div>
</div>
</div>
</div>
<%= if full_build?() do %>
<%= if assigns[:trace_id] do %>
<div class="my-6">
<%= 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 %>
</div>
<% end %>
<div class="mb-6 mt-12">
<p class="text-sm text-center">
<%= 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") %>
</p>
<p class="text-sm text-center">
<%= 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") %>
</p>
</div>
<% end %>
</div>

Loading…
Cancel
Save