Merge branch 'docs/update-clients' into 'develop'
[akkoma] / lib / pleroma / web / mastodon_api / controllers / timeline_controller.ex
index 4bbb82c2380ec3efdad66db3dd51ca84b37928f8..9244316ed2406d9e98c8e948e71cd8ae78ccaf64 100644 (file)
@@ -8,6 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do
   import Pleroma.Web.ControllerHelper,
     only: [add_link_headers: 2, add_link_headers: 3]
 
+  alias Pleroma.Config
   alias Pleroma.Pagination
   alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
   alias Pleroma.Plugs.OAuthScopesPlug
@@ -88,15 +89,12 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do
     )
   end
 
-  defp restrict_unauthenticated?(local_only) do
-    config_key =
-      if local_only do
-        :local
-      else
-        :federated
-      end
+  defp restrict_unauthenticated?(true = _local_only) do
+    Config.restrict_unauthenticated_access?(:timelines, :local)
+  end
 
-    Pleroma.Config.get([:restrict_unauthenticated, :timelines, config_key])
+  defp restrict_unauthenticated?(_) do
+    Config.restrict_unauthenticated_access?(:timelines, :federated)
   end
 
   # GET /api/v1/timelines/public