From affe0f7e56632fd4f373187e12038ed0cbd31302 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 8 Jun 2021 16:36:47 -0500 Subject: EnsurePublicOrAuthenticatedPlug: avoid dependency on Pleroma.User Speeds up recompilation by limiting compile cycles --- lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex | 5 +++-- 1 file 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, _} -> -- cgit v1.2.3