mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-13 12:31:13 +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!()
|
||||
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}),
|
||||
event: "pleroma:follow_relationships_update",
|
||||
|
@ -117,14 +121,22 @@ defmodule Pleroma.Web.StreamerView do
|
|||
%{
|
||||
state: item.state,
|
||||
follower: %{
|
||||
id: item.follower.id,
|
||||
follower_count: item.follower.follower_count,
|
||||
following_count: item.follower.following_count
|
||||
id: follower.id,
|
||||
follower_count: follower.follower_count,
|
||||
following_count: follower.following_count
|
||||
},
|
||||
following: %{
|
||||
id: item.following.id,
|
||||
follower_count: item.following.follower_count,
|
||||
following_count: item.following.following_count
|
||||
id: following.id,
|
||||
follower_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!()
|
||||
|
|
Loading…
Reference in a new issue