mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-18 05:06:15 +00:00
StreamerView: Do not leak follows count if hidden
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
b389b85d77
commit
52f7033f7a
2 changed files with 20 additions and 7 deletions
1
changelog.d/stream-follow-relationships-count.fix
Normal file
1
changelog.d/stream-follow-relationships-count.fix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
StreamerView: Do not leak follows count if hidden
|
|
@ -109,7 +109,11 @@ defmodule Pleroma.Web.StreamerView do
|
||||||
|> Jason.encode!()
|
|> Jason.encode!()
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("follow_relationships_update.json", item, topic) do
|
def render(
|
||||||
|
"follow_relationships_update.json",
|
||||||
|
%{follower: follower, following: following} = item,
|
||||||
|
topic
|
||||||
|
) do
|
||||||
%{
|
%{
|
||||||
stream: render("stream.json", %{topic: topic}),
|
stream: render("stream.json", %{topic: topic}),
|
||||||
event: "pleroma:follow_relationships_update",
|
event: "pleroma:follow_relationships_update",
|
||||||
|
@ -117,14 +121,22 @@ defmodule Pleroma.Web.StreamerView do
|
||||||
%{
|
%{
|
||||||
state: item.state,
|
state: item.state,
|
||||||
follower: %{
|
follower: %{
|
||||||
id: item.follower.id,
|
id: follower.id,
|
||||||
follower_count: item.follower.follower_count,
|
follower_count: follower.follower_count,
|
||||||
following_count: item.follower.following_count
|
following_count: follower.following_count
|
||||||
},
|
},
|
||||||
following: %{
|
following: %{
|
||||||
id: item.following.id,
|
id: following.id,
|
||||||
follower_count: item.following.follower_count,
|
follower_count:
|
||||||
following_count: item.following.following_count
|
if(!following.hide_followers_count or !following.hide_followers,
|
||||||
|
do: following.follower_count,
|
||||||
|
else: 0
|
||||||
|
),
|
||||||
|
following_count:
|
||||||
|
if(!following.hide_follows_count or !following.hide_follows,
|
||||||
|
do: following.following_count,
|
||||||
|
else: 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> Jason.encode!()
|
|> Jason.encode!()
|
||||||
|
|
Loading…
Reference in a new issue