activitypub: user view: formatting
This commit is contained in:
parent
5307c211b8
commit
72ba5b4ab7
|
@ -104,6 +104,7 @@ def render("following.json", %{user: user, page: page}) do
|
||||||
query = User.get_friends_query(user)
|
query = User.get_friends_query(user)
|
||||||
query = from(user in query, select: [:ap_id])
|
query = from(user in query, select: [:ap_id])
|
||||||
following = Repo.all(query)
|
following = Repo.all(query)
|
||||||
|
|
||||||
total =
|
total =
|
||||||
if !user.info.hide_follows do
|
if !user.info.hide_follows do
|
||||||
length(following)
|
length(following)
|
||||||
|
@ -119,6 +120,7 @@ def render("following.json", %{user: user}) do
|
||||||
query = User.get_friends_query(user)
|
query = User.get_friends_query(user)
|
||||||
query = from(user in query, select: [:ap_id])
|
query = from(user in query, select: [:ap_id])
|
||||||
following = Repo.all(query)
|
following = Repo.all(query)
|
||||||
|
|
||||||
total =
|
total =
|
||||||
if !user.info.hide_follows do
|
if !user.info.hide_follows do
|
||||||
length(following)
|
length(following)
|
||||||
|
@ -139,6 +141,7 @@ def render("followers.json", %{user: user, page: page}) do
|
||||||
query = User.get_followers_query(user)
|
query = User.get_followers_query(user)
|
||||||
query = from(user in query, select: [:ap_id])
|
query = from(user in query, select: [:ap_id])
|
||||||
followers = Repo.all(query)
|
followers = Repo.all(query)
|
||||||
|
|
||||||
total =
|
total =
|
||||||
if !user.info.hide_followers do
|
if !user.info.hide_followers do
|
||||||
length(followers)
|
length(followers)
|
||||||
|
@ -154,6 +157,7 @@ def render("followers.json", %{user: user}) do
|
||||||
query = User.get_followers_query(user)
|
query = User.get_followers_query(user)
|
||||||
query = from(user in query, select: [:ap_id])
|
query = from(user in query, select: [:ap_id])
|
||||||
followers = Repo.all(query)
|
followers = Repo.all(query)
|
||||||
|
|
||||||
total =
|
total =
|
||||||
if !user.info.hide_followers do
|
if !user.info.hide_followers do
|
||||||
length(followers)
|
length(followers)
|
||||||
|
@ -165,7 +169,8 @@ def render("followers.json", %{user: user}) do
|
||||||
"id" => "#{user.ap_id}/followers",
|
"id" => "#{user.ap_id}/followers",
|
||||||
"type" => "OrderedCollection",
|
"type" => "OrderedCollection",
|
||||||
"totalItems" => total,
|
"totalItems" => total,
|
||||||
"first" => collection(followers, "#{user.ap_id}/followers", 1, !user.info.hide_followers, total)
|
"first" =>
|
||||||
|
collection(followers, "#{user.ap_id}/followers", 1, !user.info.hide_followers, total)
|
||||||
}
|
}
|
||||||
|> Map.merge(Utils.make_json_ld_header())
|
|> Map.merge(Utils.make_json_ld_header())
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue