aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/user.ex
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-03-22 17:10:37 +0300
committerrinpatch <rinpatch@sdf.org>2020-03-22 17:10:37 +0300
commit981e015f1b68c7cf807b0ddbf3948809f11b7fff (patch)
tree2d71289517f63f2135ac934c5850c5fb0cba9c0c /lib/pleroma/user.ex
parentd74405fc1a27bb3d13f4ead2bc2369f23827a781 (diff)
downloadpleroma-981e015f1b68c7cf807b0ddbf3948809f11b7fff.tar.gz
Mastodon API Account view: Remove an outdated hack
The hack with caching the follow relationship was introduced when we still were storing it inside the follow activity, resulting in slow queries. Now we store follow state in `FollowRelationship` table, so this is no longer necessary.
Diffstat (limited to 'lib/pleroma/user.ex')
-rw-r--r--lib/pleroma/user.ex18
1 files changed, 0 insertions, 18 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 8693c0b80..12c2ad815 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -292,24 +292,6 @@ defmodule Pleroma.User do
def ap_following(%User{following_address: fa}) when is_binary(fa), do: fa
def ap_following(%User{} = user), do: "#{ap_id(user)}/following"
- def follow_state(%User{} = user, %User{} = target) do
- case Utils.fetch_latest_follow(user, target) do
- %{data: %{"state" => state}} -> state
- # Ideally this would be nil, but then Cachex does not commit the value
- _ -> false
- end
- end
-
- def get_cached_follow_state(user, target) do
- key = "follow_state:#{user.ap_id}|#{target.ap_id}"
- Cachex.fetch!(:user_cache, key, fn _ -> {:commit, follow_state(user, target)} end)
- end
-
- @spec set_follow_state_cache(String.t(), String.t(), String.t()) :: {:ok | :error, boolean()}
- def set_follow_state_cache(user_ap_id, target_ap_id, state) do
- Cachex.put(:user_cache, "follow_state:#{user_ap_id}|#{target_ap_id}", state)
- end
-
@spec restrict_deactivated(Ecto.Query.t()) :: Ecto.Query.t()
def restrict_deactivated(query) do
from(u in query, where: u.deactivated != ^true)