Skip to content

Commit

Permalink
Follow count request shoudlnt assume following_address and follower_a…
Browse files Browse the repository at this point in the history
…ddress are not nil
  • Loading branch information
Cl0v1s committed Jun 18, 2023
1 parent 1c44e4e commit 382a3e3
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/pleroma/web/activity_pub/activity_pub.ex
Expand Up @@ -1641,11 +1641,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp generate_nickname(_), do: nil

def fetch_follow_information_for_user(user) do
with {:ok, following_data} <-
Fetcher.fetch_and_contain_remote_object_from_id(user.following_address),
with {:ok, following_data} <- (
case user.following_address do
nil -> {:ok, %{ "totalItems" => 0 }}
_ -> Fetcher.fetch_and_contain_remote_object_from_id(user.following_address)
end
),
{:ok, hide_follows} <- collection_private(following_data),
{:ok, followers_data} <-
Fetcher.fetch_and_contain_remote_object_from_id(user.follower_address),
{:ok, followers_data}<- (
case user.follower_address do
nil -> {:ok, %{ "totalItems" => 0 }}
_ -> Fetcher.fetch_and_contain_remote_object_from_id(user.follower_address)
end
),
{:ok, hide_followers} <- collection_private(followers_data) do
{:ok,
%{
Expand All @@ -1655,8 +1663,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
hide_followers: hide_followers
}}
else
{:error, _} = e -> e
e -> {:error, e}
{:error, _} = e ->
e
e ->
{:error, e}
end
end

Expand Down

0 comments on commit 382a3e3

Please sign in to comment.