From: lain Date: Sun, 2 Dec 2018 10:20:38 +0000 (+0100) Subject: Fix background updating / handling. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=91065e1968e97d299aa708b938cbef18c2cd1271;p=akkoma Fix background updating / handling. --- diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index 94d403bf7..49b2f0eda 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -4,7 +4,7 @@ defmodule Pleroma.User.Info do embedded_schema do field(:banner, :map, default: %{}) - field(:background, :string, default: nil) + field(:background, :map, default: %{}) field(:source_data, :map, default: %{}) field(:note_count, :integer, default: 0) field(:follower_count, :integer, default: 0) @@ -134,7 +134,8 @@ defmodule Pleroma.User.Info do :locked, :no_rich_text, :default_scope, - :banner + :banner, + :background ]) end diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs index baa8cac72..32bf6691b 100644 --- a/test/web/ostatus/ostatus_test.exs +++ b/test/web/ostatus/ostatus_test.exs @@ -337,7 +337,7 @@ defmodule Pleroma.Web.OStatusTest do %Pleroma.User.Info{ id: user.info.id, ap_enabled: false, - background: nil, + background: %{}, banner: %{}, blocks: [], deactivated: false, diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 89c176da7..539876323 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -24,6 +24,9 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do |> assign(:user, user) |> post(authenticated_twitter_api__path(conn, :update_banner), %{"banner" => new_banner}) |> json_response(200) + + user = Repo.get(User, user.id) + assert user.info.banner["type"] == "Image" end end @@ -39,6 +42,9 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do |> assign(:user, user) |> post(authenticated_twitter_api__path(conn, :update_background), %{"img" => new_bg}) |> json_response(200) + + user = Repo.get(User, user.id) + assert user.info.background["type"] == "Image" end end