Revert "Stop exposing if a user blocks you over the API."

This reverts commit 1b560d547a.
This commit is contained in:
Sam Therapy 2023-06-06 01:01:38 +02:00
parent fab2fbdcc0
commit 2598b98cc6
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
4 changed files with 12 additions and 23 deletions

View file

@ -772,7 +772,7 @@ defp array_of_relationships do
"showing_reblogs" => true,
"followed_by" => true,
"blocking" => false,
"blocked_by" => false,
"blocked_by" => true,
"muting" => false,
"muting_notifications" => false,
"note" => "",
@ -788,7 +788,7 @@ defp array_of_relationships do
"showing_reblogs" => true,
"followed_by" => true,
"blocking" => false,
"blocked_by" => false,
"blocked_by" => true,
"muting" => true,
"muting_notifications" => false,
"note" => "",

View file

@ -13,10 +13,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationship do
description: "Relationship between current account and requested account",
type: :object,
properties: %{
blocked_by: %Schema{
type: :boolean,
description: "Represents being blocked by this user. Always false."
},
blocked_by: %Schema{type: :boolean},
blocking: %Schema{type: :boolean},
domain_blocking: %Schema{type: :boolean},
endorsed: %Schema{type: :boolean},

View file

@ -124,7 +124,14 @@ def render(
target,
&User.blocks_user?(&1, &2)
),
blocked_by: false,
blocked_by:
UserRelationship.exists?(
user_relationships,
:block,
target,
reading_user,
&User.blocks_user?(&1, &2)
),
muting:
UserRelationship.exists?(
user_relationships,

View file

@ -399,22 +399,7 @@ test "represent a relationship for the blocking and blocked user" do
expected =
Map.merge(
@blank_response,
%{following: false, blocking: true, blocked_by: false, id: to_string(other_user.id)}
)
test_relationship_rendering(user, other_user, expected)
end
test "blocks are not visible to the blocked user" do
user = insert(:user)
other_user = insert(:user)
{:ok, _user_relationship} = User.block(other_user, user)
expected =
Map.merge(
@blank_response,
%{following: false, blocking: false, blocked_by: false, id: to_string(other_user.id)}
%{following: false, blocking: true, blocked_by: true, id: to_string(other_user.id)}
)
test_relationship_rendering(user, other_user, expected)