User: Add settings store to Info, AccountView

This is to provide a generic frontend settings storage mechanism for all kinds
of frontends.
This commit is contained in:
lain 2019-05-31 14:27:15 +02:00
commit eb2963bc43
3 changed files with 26 additions and 0 deletions

View file

@ -239,4 +239,19 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert expected == AccountView.render("account.json", %{user: user, for: other_user})
end
test "returns the settings store if the requesting user is the represented user and it's requested specifically" do
user = insert(:user, %{info: %User.Info{pleroma_settings_store: %{fe: "test"}}})
result =
AccountView.render("account.json", %{user: user, for: user, with_pleroma_settings: true})
assert result.pleroma.settings == %{:fe => "test"}
result = AccountView.render("account.json", %{user: user, with_pleroma_settings: true})
assert result.pleroma[:settings] == nil
result = AccountView.render("account.json", %{user: user, for: user})
assert result.pleroma[:settings] == nil
end
end