diff options
author | lain <lain@soykaf.club> | 2018-11-18 18:06:02 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-11-18 18:06:02 +0100 |
commit | 47d883d3abb4d64721b2a8ed925021dfeeaa4459 (patch) | |
tree | 0dd904abef9f17ecdd69ab9d32a036c2ce69ede4 /lib | |
parent | 50585d051b9366903943f7388219ac96af6c8621 (diff) | |
download | pleroma-47d883d3abb4d64721b2a8ed925021dfeeaa4459.tar.gz |
Fix User deactivation.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 6e1d5559d..7336e8540 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -19,11 +19,11 @@ defmodule Pleroma.User do field(:ap_id, :string) field(:avatar, :map) field(:local, :boolean, default: true) - field(:info, :map, default: %{}) field(:follower_address, :string) field(:search_distance, :float, virtual: true) field(:last_refreshed_at, :naive_datetime) has_many(:notifications, Notification) + embeds_one :info, Pleroma.User.Info timestamps() end @@ -71,10 +71,10 @@ defmodule Pleroma.User do %{ following_count: length(user.following) - oneself, - note_count: user.info["note_count"] || 0, - follower_count: user.info["follower_count"] || 0, - locked: user.info["locked"] || false, - default_scope: user.info["default_scope"] || "public" + note_count: user.info.note_count, + follower_count: user.info.follower_count, + locked: user.info.locked, + default_scope: user.info.default_scope } end @@ -613,9 +613,11 @@ defmodule Pleroma.User do end def deactivate(%User{} = user, status \\ true) do - new_info = Map.put(user.info, "deactivated", status) - cs = User.info_changeset(user, %{info: new_info}) - update_and_set_cache(cs) + info_cng = User.Info.set_activation_status(user.info, status) + cng = change(user) + |> put_embed(:info, info_cng) + + update_and_set_cache(cng) end def delete(%User{} = user) do |