Finish undoing API breakage

This commit is contained in:
Mark Felder 2020-10-14 10:44:18 -05:00
parent 3242cfef20
commit b001237b79
5 changed files with 6 additions and 6 deletions

View file

@ -110,7 +110,7 @@ def render("user.json", %{user: user}) do
"endpoints" => endpoints, "endpoints" => endpoints,
"attachment" => fields, "attachment" => fields,
"tag" => emoji_tags, "tag" => emoji_tags,
"is_discoverable" => user.is_discoverable, "discoverable" => user.is_discoverable,
"capabilities" => capabilities "capabilities" => capabilities
} }
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user)) |> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))

View file

@ -186,7 +186,6 @@ def update_credentials(%{assigns: %{user: user}, body_params: params} = conn, _p
:show_role, :show_role,
:skip_thread_containment, :skip_thread_containment,
:allow_following_move, :allow_following_move,
:is_discoverable,
:accepts_chat_messages :accepts_chat_messages
] ]
|> Enum.reduce(%{}, fn key, acc -> |> Enum.reduce(%{}, fn key, acc ->
@ -210,6 +209,7 @@ def update_credentials(%{assigns: %{user: user}, body_params: params} = conn, _p
if bot, do: {:ok, "Service"}, else: {:ok, "Person"} if bot, do: {:ok, "Service"}, else: {:ok, "Person"}
end) end)
|> Maps.put_if_present(:actor_type, params[:actor_type]) |> Maps.put_if_present(:actor_type, params[:actor_type])
|> Maps.put_if_present(:is_discoverable, params[:discoverable])
# What happens here: # What happens here:
# #

View file

@ -261,7 +261,7 @@ defp do_render("show.json", %{user: user} = opts) do
sensitive: false, sensitive: false,
fields: user.raw_fields, fields: user.raw_fields,
pleroma: %{ pleroma: %{
is_discoverable: user.is_discoverable, discoverable: user.is_discoverable,
actor_type: user.actor_type actor_type: user.actor_type
} }
}, },

View file

@ -1278,7 +1278,7 @@ test "registration from trusted app" do
"note" => "", "note" => "",
"pleroma" => %{ "pleroma" => %{
"actor_type" => "Person", "actor_type" => "Person",
"is_discoverable" => false, "discoverable" => false,
"no_rich_text" => false, "no_rich_text" => false,
"show_role" => true "show_role" => true
}, },

View file

@ -69,7 +69,7 @@ test "Represent a user account" do
sensitive: false, sensitive: false,
pleroma: %{ pleroma: %{
actor_type: "Person", actor_type: "Person",
is_discoverable: true discoverable: true
}, },
fields: [] fields: []
}, },
@ -167,7 +167,7 @@ test "Represent a Service(bot) account" do
sensitive: false, sensitive: false,
pleroma: %{ pleroma: %{
actor_type: "Service", actor_type: "Service",
is_discoverable: true discoverable: true
}, },
fields: [] fields: []
}, },