From ca79aab0bf4bebab4dc7a28fce86955b7a6a5cea Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 15 Apr 2021 23:33:24 -0600 Subject: [PATCH] Remove MastoFE settings from users table --- lib/pleroma/user.ex | 9 --------- .../20210416051708_remove_mastofe_settings_from_users.exs | 9 +++++++++ test/pleroma/user_test.exs | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index c1aa0f716..a3d41fcd0 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -123,7 +123,6 @@ defmodule Pleroma.User do field(:is_moderator, :boolean, default: false) field(:is_admin, :boolean, default: false) field(:show_role, :boolean, default: true) - field(:mastofe_settings, :map, default: nil) field(:uri, ObjectValidators.Uri, default: nil) field(:hide_followers_count, :boolean, default: false) field(:hide_follows_count, :boolean, default: false) @@ -1702,7 +1701,6 @@ defmodule Pleroma.User do ap_enabled: false, is_moderator: false, is_admin: false, - mastofe_settings: nil, mascot: nil, emoji: %{}, pleroma_settings_store: %{}, @@ -2313,13 +2311,6 @@ defmodule Pleroma.User do |> update_and_set_cache() end - def mastodon_settings_update(user, settings) do - user - |> cast(%{mastofe_settings: settings}, [:mastofe_settings]) - |> validate_required([:mastofe_settings]) - |> update_and_set_cache() - end - @spec confirmation_changeset(User.t(), keyword()) :: Changeset.t() def confirmation_changeset(user, set_confirmation: confirmed?) do params = diff --git a/priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs b/priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs new file mode 100644 index 000000000..a8d7306bd --- /dev/null +++ b/priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs @@ -0,0 +1,9 @@ +defmodule Pleroma.Repo.Migrations.RemoveMastofeSettingsFromUsers do + use Ecto.Migration + + def change do + alter table(:users) do + remove_if_exists(:mastofe_settings, :map) + end + end +end diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 6f5bcab57..faaf86fcb 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1631,7 +1631,6 @@ defmodule Pleroma.UserTest do ap_enabled: true, is_moderator: true, is_admin: true, - mastofe_settings: %{"a" => "b"}, mascot: %{"a" => "b"}, emoji: %{"a" => "b"}, pleroma_settings_store: %{"q" => "x"}, @@ -1673,7 +1672,6 @@ defmodule Pleroma.UserTest do ap_enabled: false, is_moderator: false, is_admin: false, - mastofe_settings: nil, mascot: nil, emoji: %{}, pleroma_settings_store: %{},