Browse Source

mastodon api: relationship view: better handle no pre-existing follow activity

tags/v0.9.9
William Pitcock 5 years ago
parent
commit
7f530f6f80
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      lib/pleroma/web/mastodon_api/views/account_view.ex

+ 7
- 1
lib/pleroma/web/mastodon_api/views/account_view.ex View File

@@ -73,7 +73,13 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do

def render("relationship.json", %{user: user, target: target}) do
follow_activity = Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(user, target)
requested = follow_activity.data["state"] == "pending"

requested =
if follow_activity do
follow_activity.data["state"] == "pending"
else
false
end

%{
id: to_string(target.id),


Loading…
Cancel
Save