Fix background updating / handling.

This commit is contained in:
lain 2018-12-02 11:20:38 +01:00
parent 371d96b1da
commit 91065e1968
3 changed files with 10 additions and 3 deletions

View file

@ -4,7 +4,7 @@ defmodule Pleroma.User.Info do
embedded_schema do embedded_schema do
field(:banner, :map, default: %{}) field(:banner, :map, default: %{})
field(:background, :string, default: nil) field(:background, :map, default: %{})
field(:source_data, :map, default: %{}) field(:source_data, :map, default: %{})
field(:note_count, :integer, default: 0) field(:note_count, :integer, default: 0)
field(:follower_count, :integer, default: 0) field(:follower_count, :integer, default: 0)
@ -134,7 +134,8 @@ def profile_update(info, params) do
:locked, :locked,
:no_rich_text, :no_rich_text,
:default_scope, :default_scope,
:banner :banner,
:background
]) ])
end end

View file

@ -337,7 +337,7 @@ test "find_or_make_user sets all the nessary input fields" do
%Pleroma.User.Info{ %Pleroma.User.Info{
id: user.info.id, id: user.info.id,
ap_enabled: false, ap_enabled: false,
background: nil, background: %{},
banner: %{}, banner: %{},
blocks: [], blocks: [],
deactivated: false, deactivated: false,

View file

@ -24,6 +24,9 @@ test "it updates the banner", %{conn: conn} do
|> assign(:user, user) |> assign(:user, user)
|> post(authenticated_twitter_api__path(conn, :update_banner), %{"banner" => new_banner}) |> post(authenticated_twitter_api__path(conn, :update_banner), %{"banner" => new_banner})
|> json_response(200) |> json_response(200)
user = Repo.get(User, user.id)
assert user.info.banner["type"] == "Image"
end end
end end
@ -39,6 +42,9 @@ test "it updates the background", %{conn: conn} do
|> assign(:user, user) |> assign(:user, user)
|> post(authenticated_twitter_api__path(conn, :update_background), %{"img" => new_bg}) |> post(authenticated_twitter_api__path(conn, :update_background), %{"img" => new_bg})
|> json_response(200) |> json_response(200)
user = Repo.get(User, user.id)
assert user.info.background["type"] == "Image"
end end
end end