Merge branch 'feature/mastodon_api_2.4.x' into 'develop'
authorkaniini <nenolod@gmail.com>
Mon, 3 Sep 2018 12:33:36 +0000 (12:33 +0000)
committerkaniini <nenolod@gmail.com>
Mon, 3 Sep 2018 12:33:36 +0000 (12:33 +0000)
Add/Fix Mastodon endpoints for 2.4.3 compatibility

See merge request pleroma/pleroma!266

1  2 
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/views/account_view.ex
test/web/mastodon_api/mastodon_api_controller_test.exs

index 7bc32e688ffc180e7318b25c226e1473e3c65044,634985fb6b73d96b176565897257d2ceb20f8a75..85aac493f809a1db8a47110ea1f8b5ea9633f853
@@@ -26,9 -27,14 +27,14 @@@ defmodule Pleroma.Web.MastodonAPI.Accou
          }
        end)
  
+     fields =
+       (user.info["source_data"]["attachment"] || [])
+       |> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
+       |> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end)
      %{
        id: to_string(user.id),
 -      username: hd(String.split(user.nickname, "@")),
 +      username: username_from_nickname(user.nickname),
        acct: user.nickname,
        display_name: user.name || user.nickname,
        locked: user_info.locked,
        header: header,
        header_static: header,
        emojis: emojis,
-       fields: [],
+       fields: fields,
+       bot: bot,
        source: %{
          note: "",
 -        privacy: "public",
 +        privacy: user_info.default_scope,
          sensitive: "false"
        }
      }