Remove MastoFE settings from users table

This commit is contained in:
Sean King 2021-04-15 23:33:24 -06:00
parent 8afa3f2d1b
commit ca79aab0bf
No known key found for this signature in database
GPG Key ID: 510C52BACD6E7257
3 changed files with 9 additions and 11 deletions

View File

@ -123,7 +123,6 @@ defmodule Pleroma.User do
field(:is_moderator, :boolean, default: false) field(:is_moderator, :boolean, default: false)
field(:is_admin, :boolean, default: false) field(:is_admin, :boolean, default: false)
field(:show_role, :boolean, default: true) field(:show_role, :boolean, default: true)
field(:mastofe_settings, :map, default: nil)
field(:uri, ObjectValidators.Uri, default: nil) field(:uri, ObjectValidators.Uri, default: nil)
field(:hide_followers_count, :boolean, default: false) field(:hide_followers_count, :boolean, default: false)
field(:hide_follows_count, :boolean, default: false) field(:hide_follows_count, :boolean, default: false)
@ -1702,7 +1701,6 @@ def purge_user_changeset(user) do
ap_enabled: false, ap_enabled: false,
is_moderator: false, is_moderator: false,
is_admin: false, is_admin: false,
mastofe_settings: nil,
mascot: nil, mascot: nil,
emoji: %{}, emoji: %{},
pleroma_settings_store: %{}, pleroma_settings_store: %{},
@ -2313,13 +2311,6 @@ def mascot_update(user, url) do
|> update_and_set_cache() |> update_and_set_cache()
end 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() @spec confirmation_changeset(User.t(), keyword()) :: Changeset.t()
def confirmation_changeset(user, set_confirmation: confirmed?) do def confirmation_changeset(user, set_confirmation: confirmed?) do
params = params =

View File

@ -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

View File

@ -1631,7 +1631,6 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
ap_enabled: true, ap_enabled: true,
is_moderator: true, is_moderator: true,
is_admin: true, is_admin: true,
mastofe_settings: %{"a" => "b"},
mascot: %{"a" => "b"}, mascot: %{"a" => "b"},
emoji: %{"a" => "b"}, emoji: %{"a" => "b"},
pleroma_settings_store: %{"q" => "x"}, pleroma_settings_store: %{"q" => "x"},
@ -1673,7 +1672,6 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
ap_enabled: false, ap_enabled: false,
is_moderator: false, is_moderator: false,
is_admin: false, is_admin: false,
mastofe_settings: nil,
mascot: nil, mascot: nil,
emoji: %{}, emoji: %{},
pleroma_settings_store: %{}, pleroma_settings_store: %{},