diff options
| author | rinpatch <rinpatch@sdf.org> | 2020-04-29 14:26:31 +0300 | 
|---|---|---|
| committer | rinpatch <rinpatch@sdf.org> | 2020-05-01 00:38:58 +0300 | 
| commit | 61889e00fc4a77e92ed7af3b6a270d10d5b2f34b (patch) | |
| tree | 05eadfdac17a8c6cb2e01a8fcb5b1a9558319f74 /test | |
| parent | 3b15a0eecc62f79465620a697f12b576ed87b0fc (diff) | |
| download | pleroma-61889e00fc4a77e92ed7af3b6a270d10d5b2f34b.tar.gz pleroma-61889e00fc4a77e92ed7af3b6a270d10d5b2f34b.zip  | |
Deactivate local users on deletion instead of deleting the record
Prevents the possibility of re-registration, which allowed to read
DMs of the deleted account.
Also includes a migration that tries to find any already deleted
accounts and insert skeletons for them.
Closes pleroma/pleroma#1687
Diffstat (limited to 'test')
| -rw-r--r-- | test/tasks/user_test.exs | 2 | ||||
| -rw-r--r-- | test/user_test.exs | 14 | ||||
| -rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 3 | 
3 files changed, 5 insertions, 14 deletions
diff --git a/test/tasks/user_test.exs b/test/tasks/user_test.exs index b45f37263..22030a423 100644 --- a/test/tasks/user_test.exs +++ b/test/tasks/user_test.exs @@ -92,7 +92,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do        assert_received {:mix_shell, :info, [message]}        assert message =~ " deleted" -      refute User.get_by_nickname(user.nickname) +      assert %{deactivated: true} = User.get_by_nickname(user.nickname)      end      test "no user to delete" do diff --git a/test/user_test.exs b/test/user_test.exs index f3d044a80..555bbb92f 100644 --- a/test/user_test.exs +++ b/test/user_test.exs @@ -1127,16 +1127,7 @@ defmodule Pleroma.UserTest do        refute Activity.get_by_id(activity.id)      end -    test "it deletes deactivated user" do -      {:ok, user} = insert(:user, deactivated: true) |> User.set_cache() - -      {:ok, job} = User.delete(user) -      {:ok, _user} = ObanHelpers.perform(job) - -      refute User.get_by_id(user.id) -    end - -    test "it deletes a user, all follow relationships and all activities", %{user: user} do +    test "it deactivates a user, all follow relationships and all activities", %{user: user} do        follower = insert(:user)        {:ok, follower} = User.follow(follower, user) @@ -1156,8 +1147,7 @@ defmodule Pleroma.UserTest do        follower = User.get_cached_by_id(follower.id)        refute User.following?(follower, user) -      refute User.get_by_id(user.id) -      assert {:ok, nil} == Cachex.get(:user_cache, "ap_id:#{user.ap_id}") +      assert %{deactivated: true} = User.get_by_id(user.id)        user_activities =          user.ap_id diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index efbca82f6..2baf9ce03 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -870,7 +870,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do      @tag capture_log: true      test "it works for incoming user deletes" do -      %{ap_id: ap_id} = insert(:user, ap_id: "http://mastodon.example.org/users/admin") +      %{ap_id: ap_id} = +        insert(:user, ap_id: "http://mastodon.example.org/users/admin", local: false)        data =          File.read!("test/fixtures/mastodon-delete-user.json")  | 
