MastoAPI: Add blocking to AccountView.
authorRoger Braun <roger@rogerbraun.net>
Fri, 3 Nov 2017 07:23:31 +0000 (08:23 +0100)
committerRoger Braun <roger@rogerbraun.net>
Fri, 3 Nov 2017 07:23:31 +0000 (08:23 +0100)
lib/pleroma/web/mastodon_api/views/account_view.ex
test/web/mastodon_api/account_view_test.exs

index ff02587d66d6fbe9428d5444c33c0e4166db6e5b..cf97ab746858900880060f6fd2f6b197fbdcd004 100644 (file)
@@ -55,7 +55,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
       id: target.id,
       following: User.following?(user, target),
       followed_by: User.following?(target, user),
-      blocking: false,
+      blocking: User.blocks?(user, target),
       muting: false,
       requested: false,
       domain_blocking: false
index aa74ed9668a8d940ed794c904c8139715b0c0af5..c62cb4f36265c9f47e172d28f09d65bc31149f3d 100644 (file)
@@ -51,12 +51,13 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
     other_user = insert(:user)
 
     {:ok, user} = User.follow(user, other_user)
+    {:ok, user} = User.block(user, other_user)
 
     expected = %{
       id: other_user.id,
       following: true,
       followed_by: false,
-      blocking: false,
+      blocking: true,
       muting: false,
       requested: false,
       domain_blocking: false