little fix
This commit is contained in:
parent
4aaffe3a10
commit
46dab37351
|
@ -362,6 +362,7 @@ def get_by_object_ap_id_with_object(ap_id) when is_binary(ap_id) do
|
||||||
ap_id
|
ap_id
|
||||||
|> Queries.by_object_id()
|
|> Queries.by_object_id()
|
||||||
|> with_preloaded_object()
|
|> with_preloaded_object()
|
||||||
|
|> first()
|
||||||
|> Repo.one()
|
|> Repo.one()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -231,4 +231,20 @@ test "all_by_actor_and_id/2" do
|
||||||
|
|
||||||
assert [%Activity{id: ^id1}, %Activity{id: ^id2}] = activities
|
assert [%Activity{id: ^id1}, %Activity{id: ^id2}] = activities
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "get_by_object_ap_id_with_object/1" do
|
||||||
|
user = insert(:user)
|
||||||
|
another = insert(:user)
|
||||||
|
|
||||||
|
{:ok, %{id: id, object: %{data: %{"id" => obj_id}}}} =
|
||||||
|
Pleroma.Web.CommonAPI.post(user, %{status: "cofe"})
|
||||||
|
|
||||||
|
Pleroma.Web.CommonAPI.favorite(another, id)
|
||||||
|
|
||||||
|
assert obj_id
|
||||||
|
|> Pleroma.Activity.Queries.by_object_id()
|
||||||
|
|> Repo.aggregate(:count, :id) == 2
|
||||||
|
|
||||||
|
assert %{id: ^id} = Activity.get_by_object_ap_id_with_object(obj_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -882,10 +882,12 @@ test "forwarded report from mastodon", %{conn: conn} do
|
||||||
actor = insert(:user, local: false)
|
actor = insert(:user, local: false)
|
||||||
remote_domain = URI.parse(actor.ap_id).host
|
remote_domain = URI.parse(actor.ap_id).host
|
||||||
remote_actor = "https://#{remote_domain}/actor"
|
remote_actor = "https://#{remote_domain}/actor"
|
||||||
reported_user = insert(:user)
|
[reported_user, another] = insert_list(2, :user)
|
||||||
|
|
||||||
note = insert(:note_activity, user: reported_user)
|
note = insert(:note_activity, user: reported_user)
|
||||||
|
|
||||||
|
Pleroma.Web.CommonAPI.favorite(another, note.id)
|
||||||
|
|
||||||
mock_json_body =
|
mock_json_body =
|
||||||
"test/fixtures/mastodon/application_actor.json"
|
"test/fixtures/mastodon/application_actor.json"
|
||||||
|> File.read!()
|
|> File.read!()
|
||||||
|
@ -920,8 +922,6 @@ test "forwarded report from mastodon", %{conn: conn} do
|
||||||
|
|
||||||
ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
|
ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
|
||||||
|
|
||||||
assert Pleroma.Repo.aggregate(Activity, :count, :id) == 2
|
|
||||||
|
|
||||||
flag_activity = "Flag" |> Pleroma.Activity.Queries.by_type() |> Pleroma.Repo.one()
|
flag_activity = "Flag" |> Pleroma.Activity.Queries.by_type() |> Pleroma.Repo.one()
|
||||||
reported_user_ap_id = reported_user.ap_id
|
reported_user_ap_id = reported_user.ap_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue