Merge branch 'fix/put-repeats-at-activitypub-outbox' into 'develop'
Fix: Output repeats at ActivityPub outbox Closes #191 See merge request pleroma/pleroma!175
This commit is contained in:
commit
38361e7b5e
@ -98,9 +98,6 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||||||
info = User.user_info(user)
|
info = User.user_info(user)
|
||||||
|
|
||||||
params = %{
|
params = %{
|
||||||
"type" => ["Create", "Announce"],
|
|
||||||
"actor_id" => user.ap_id,
|
|
||||||
"whole_db" => true,
|
|
||||||
"limit" => "10"
|
"limit" => "10"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,10 +108,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||||||
params
|
params
|
||||||
end
|
end
|
||||||
|
|
||||||
activities = ActivityPub.fetch_public_activities(params)
|
activities = ActivityPub.fetch_user_activities(user, nil, params)
|
||||||
min_id = Enum.at(activities, 0).id
|
min_id = Enum.at(Enum.reverse(activities), 0).id
|
||||||
|
|
||||||
activities = Enum.reverse(activities)
|
|
||||||
max_id = Enum.at(activities, 0).id
|
max_id = Enum.at(activities, 0).id
|
||||||
|
|
||||||
collection =
|
collection =
|
||||||
|
@ -92,6 +92,26 @@ defmodule Pleroma.Factory do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def announce_activity_factory do
|
||||||
|
note_activity = insert(:note_activity)
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
data = %{
|
||||||
|
"type" => "Announce",
|
||||||
|
"actor" => note_activity.actor,
|
||||||
|
"object" => note_activity.data["id"],
|
||||||
|
"to" => [user.follower_address, note_activity.data["actor"]],
|
||||||
|
"cc" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
|
"context" => note_activity.data["context"]
|
||||||
|
}
|
||||||
|
|
||||||
|
%Pleroma.Activity{
|
||||||
|
data: data,
|
||||||
|
actor: user.ap_id,
|
||||||
|
recipients: data["to"]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def like_activity_factory do
|
def like_activity_factory do
|
||||||
note_activity = insert(:note_activity)
|
note_activity = insert(:note_activity)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
@ -62,6 +62,32 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "/users/:nickname/outbox" do
|
||||||
|
test "it returns a note activity in a collection", %{conn: conn} do
|
||||||
|
note_activity = insert(:note_activity)
|
||||||
|
user = User.get_cached_by_ap_id(note_activity.data["actor"])
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> put_req_header("accept", "application/activity+json")
|
||||||
|
|> get("/users/#{user.nickname}/outbox")
|
||||||
|
|
||||||
|
assert response(conn, 200) =~ note_activity.data["object"]["content"]
|
||||||
|
end
|
||||||
|
|
||||||
|
test "it returns an announce activity in a collection", %{conn: conn} do
|
||||||
|
announce_activity = insert(:announce_activity)
|
||||||
|
user = User.get_cached_by_ap_id(announce_activity.data["actor"])
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> put_req_header("accept", "application/activity+json")
|
||||||
|
|> get("/users/#{user.nickname}/outbox")
|
||||||
|
|
||||||
|
assert response(conn, 200) =~ announce_activity.data["object"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "/users/:nickname/followers" do
|
describe "/users/:nickname/followers" do
|
||||||
test "it returns the followers in a collection", %{conn: conn} do
|
test "it returns the followers in a collection", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
Loading…
Reference in New Issue
Block a user