From 91065e1968e97d299aa708b938cbef18c2cd1271 Mon Sep 17 00:00:00 2001 From: lain Date: Sun, 2 Dec 2018 11:20:38 +0100 Subject: [PATCH 1/2] Fix background updating / handling. --- lib/pleroma/user/info.ex | 5 +++-- test/web/ostatus/ostatus_test.exs | 2 +- test/web/twitter_api/twitter_api_controller_test.exs | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) 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 @@ def profile_update(info, params) 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 @@ test "find_or_make_user sets all the nessary input fields" 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 @@ test "it updates the banner", %{conn: conn} 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 @@ test "it updates the background", %{conn: conn} 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 From e3f3d13d994e2b65d796818ee424b854f83c1223 Mon Sep 17 00:00:00 2001 From: lain Date: Sun, 2 Dec 2018 11:20:49 +0100 Subject: [PATCH 2/2] Add uuid generation extension to sample_psql.eex. --- lib/mix/tasks/sample_psql.eex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mix/tasks/sample_psql.eex b/lib/mix/tasks/sample_psql.eex index b6f57948b..c89b34ef2 100644 --- a/lib/mix/tasks/sample_psql.eex +++ b/lib/mix/tasks/sample_psql.eex @@ -4,3 +4,4 @@ CREATE DATABASE pleroma_dev OWNER pleroma; --Extensions made by ecto.migrate that need superuser access CREATE EXTENSION IF NOT EXISTS citext; CREATE EXTENSION IF NOT EXISTS pg_trgm; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp";