Revert Activity tombstones, add ObjectTombstone struct
This commit is contained in:
parent
2bbec33c71
commit
f75f707f6c
9 changed files with 43 additions and 62 deletions
|
|
@ -25,28 +25,4 @@ defmodule Pleroma.ActivityTest do
|
|||
|
||||
assert activity == found_activity
|
||||
end
|
||||
|
||||
test "returns tombstone" do
|
||||
activity = insert(:note_activity)
|
||||
deleted = DateTime.utc_now()
|
||||
|
||||
assert Pleroma.Activity.get_tombstone(activity, deleted) == %{
|
||||
id: activity.data["id"],
|
||||
context: activity.data["context"],
|
||||
type: "Tombstone",
|
||||
published: activity.data["published"],
|
||||
deleted: deleted
|
||||
}
|
||||
end
|
||||
|
||||
test "swaps data with tombstone" do
|
||||
activity = insert(:note_activity)
|
||||
|
||||
{:ok, deleted} = Pleroma.Activity.swap_data_with_tombstone(activity)
|
||||
assert deleted.data.type == "Tombstone"
|
||||
|
||||
found_activity = Repo.get(Activity, activity.id)
|
||||
|
||||
assert deleted.data.type == found_activity.data["type"]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ defmodule Pleroma.ObjectTest do
|
|||
found_object = Object.get_by_ap_id(object.data["id"])
|
||||
|
||||
refute object == found_object
|
||||
|
||||
assert found_object.data["type"] == "Tombstone"
|
||||
end
|
||||
|
||||
test "ensures cache is cleared for the object" do
|
||||
|
|
@ -47,6 +49,8 @@ defmodule Pleroma.ObjectTest do
|
|||
cached_object = Object.get_cached_by_ap_id(object.data["id"])
|
||||
|
||||
refute object == cached_object
|
||||
|
||||
assert cached_object.data["type"] == "Tombstone"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ defmodule Pleroma.UserTest do
|
|||
|
||||
# TODO: Remove favorites, repeats, delete activities.
|
||||
|
||||
assert Repo.get(Activity, activity.id).data["type"] == "Tombstone"
|
||||
refute Repo.get(Activity, activity.id)
|
||||
end
|
||||
|
||||
test "get_public_key_for_ap_id fetches a user that's not in the db" do
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
|
||||
|
||||
assert Repo.get(Activity, activity.id).data["type"] == "Tombstone"
|
||||
refute Repo.get(Activity, activity.id)
|
||||
end
|
||||
|
||||
test "it fails for incoming deletes with spoofed origin" do
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
|||
|
||||
assert %{} = json_response(conn, 200)
|
||||
|
||||
assert Repo.get(Activity, activity.id).data["type"] == "Tombstone"
|
||||
refute Repo.get(Activity, activity.id)
|
||||
end
|
||||
|
||||
test "when you didn't create it", %{conn: conn} do
|
||||
|
|
@ -308,6 +308,25 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
|||
|
||||
assert Repo.get(Activity, activity.id) == activity
|
||||
end
|
||||
|
||||
# test "404 when making an attempt to get it" do
|
||||
# activity = insert(:note_activity)
|
||||
# author = User.get_by_ap_id(activity.data["actor"])
|
||||
|
||||
# conn =
|
||||
# conn
|
||||
# |> assign(:user, author)
|
||||
# |> delete("/api/v1/statuses/#{activity.id}")
|
||||
|
||||
# assert %{} = json_response(conn, 200)
|
||||
|
||||
# conn =
|
||||
# build_conn()
|
||||
# |> assign(:user, author)
|
||||
# |> get("/api/v1/statuses/#{activity.id}")
|
||||
|
||||
# assert %{} = json_response(conn, 200)
|
||||
# end
|
||||
end
|
||||
|
||||
describe "filters" do
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
|
|||
|
||||
{:ok, [delete]} = OStatus.handle_incoming(incoming)
|
||||
|
||||
assert Repo.get(Activity, note.id).data["type"] == "Tombstone"
|
||||
assert Repo.get(Activity, like.id).data["type"] == "Tombstone"
|
||||
refute Repo.get(Activity, note.id)
|
||||
refute Repo.get(Activity, like.id)
|
||||
assert Object.get_by_ap_id(note.data["object"]["id"]).data["type"] == "Tombstone"
|
||||
assert Repo.get(Activity, second_note.id)
|
||||
assert Object.get_by_ap_id(second_note.data["object"]["id"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue