summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-06-08 16:36:47 -0500
committerAlex Gleason <alex@alexgleason.me>2021-06-08 17:37:18 -0500
commitaffe0f7e56632fd4f373187e12038ed0cbd31302 (patch)
tree815289f774b0167138d5b103f2d68bc601388fcb
parentd896e45fafbdf3d1428eead9b9b9ce99668c16b3 (diff)
EnsurePublicOrAuthenticatedPlug: avoid dependency on Pleroma.Usercycles-ensure-plug
Speeds up recompilation by limiting compile cycles
-rw-r--r--lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex
index 8a8532f41..69387c610 100644
--- a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex
+++ b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex
@@ -12,7 +12,6 @@ defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug do
import Plug.Conn
alias Pleroma.Config
- alias Pleroma.User
use Pleroma.Web, :plug
@@ -28,7 +27,9 @@ defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug do
{true, _} ->
conn
- {false, %{assigns: %{user: %User{}}}} ->
+ # Avoid %User{} intentionally to reduce compile cycles.
+ # TODO: Use `is_struct/1` in Elixir 1.11
+ {false, %{assigns: %{user: %{__struct__: _}}}} ->
conn
{false, _} ->