X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fuser.ex;h=ff3ec1197e16956be0a37bc4fcdfcfdbc07aacfc;hb=4ec2fb967e0eb0559e39a6d698107f6af4d7a891;hp=72ee2d58e2951a615e247e574faf480c8e1180e2;hpb=68cb152a0861618035ac48a0e0b455f74d9b767c;p=akkoma diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 72ee2d58e..ff3ec1197 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -79,6 +79,7 @@ defmodule Pleroma.User do schema "users" do field(:bio, :string) + field(:raw_bio, :string) field(:email, :string) field(:name, :string) field(:nickname, :string) @@ -432,6 +433,7 @@ defmodule Pleroma.User do params, [ :bio, + :raw_bio, :name, :emoji, :avatar, @@ -607,7 +609,16 @@ defmodule Pleroma.User do struct |> confirmation_changeset(need_confirmation: need_confirmation?) - |> cast(params, [:bio, :email, :name, :nickname, :password, :password_confirmation, :emoji]) + |> cast(params, [ + :bio, + :raw_bio, + :email, + :name, + :nickname, + :password, + :password_confirmation, + :emoji + ]) |> validate_required([:name, :nickname, :password, :password_confirmation]) |> validate_confirmation(:password) |> unique_constraint(:email) @@ -1488,6 +1499,9 @@ defmodule Pleroma.User do end) delete_user_activities(user) + delete_notifications_from_user_activities(user) + + delete_outgoing_pending_follow_requests(user) delete_or_deactivate(user) end @@ -1574,6 +1588,13 @@ defmodule Pleroma.User do }) end + def delete_notifications_from_user_activities(%User{ap_id: ap_id}) do + Notification + |> join(:inner, [n], activity in assoc(n, :activity)) + |> where([n, a], fragment("? = ?", a.actor, ^ap_id)) + |> Repo.delete_all() + end + def delete_user_activities(%User{ap_id: ap_id} = user) do ap_id |> Activity.Queries.by_actor() @@ -1611,6 +1632,12 @@ defmodule Pleroma.User do defp delete_activity(_activity, _user), do: "Doing nothing" + defp delete_outgoing_pending_follow_requests(user) do + user + |> FollowingRelationship.outgoing_pending_follow_requests_query() + |> Repo.delete_all() + end + def html_filter_policy(%User{no_rich_text: true}) do Pleroma.HTML.Scrubber.TwitterText end