Address liking / announcing to the original author.
This commit is contained in:
parent
4799dc6991
commit
4f7adb343c
|
@ -33,7 +33,7 @@ def like(%User{ap_id: ap_id} = user, %Object{data: %{ "id" => id}} = object) do
|
||||||
"type" => "Like",
|
"type" => "Like",
|
||||||
"actor" => ap_id,
|
"actor" => ap_id,
|
||||||
"object" => id,
|
"object" => id,
|
||||||
"to" => [User.ap_followers(user)]
|
"to" => [User.ap_followers(user), object.data["actor"]]
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, activity} = insert(data)
|
{:ok, activity} = insert(data)
|
||||||
|
@ -142,7 +142,7 @@ def announce(%User{ap_id: ap_id} = user, %Object{data: %{"id" => id}} = object)
|
||||||
"type" => "Announce",
|
"type" => "Announce",
|
||||||
"actor" => ap_id,
|
"actor" => ap_id,
|
||||||
"object" => id,
|
"object" => id,
|
||||||
"to" => [User.ap_followers(user)]
|
"to" => [User.ap_followers(user), object.data["actor"]]
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, activity} = insert(data)
|
{:ok, activity} = insert(data)
|
||||||
|
|
|
@ -124,7 +124,7 @@ test "adds a like activity to the db" do
|
||||||
assert like_activity.data["actor"] == user.ap_id
|
assert like_activity.data["actor"] == user.ap_id
|
||||||
assert like_activity.data["type"] == "Like"
|
assert like_activity.data["type"] == "Like"
|
||||||
assert like_activity.data["object"] == object.data["id"]
|
assert like_activity.data["object"] == object.data["id"]
|
||||||
assert like_activity.data["to"] == [User.ap_followers(user)]
|
assert like_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]]
|
||||||
assert object.data["like_count"] == 1
|
assert object.data["like_count"] == 1
|
||||||
assert object.data["likes"] == [user.ap_id]
|
assert object.data["likes"] == [user.ap_id]
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ test "adds an announce activity to the db" do
|
||||||
{:ok, announce_activity, object} = ActivityPub.announce(user, object)
|
{:ok, announce_activity, object} = ActivityPub.announce(user, object)
|
||||||
assert object.data["announcement_count"] == 1
|
assert object.data["announcement_count"] == 1
|
||||||
assert object.data["announcements"] == [user.ap_id]
|
assert object.data["announcements"] == [user.ap_id]
|
||||||
assert announce_activity.data["to"] == [User.ap_followers(user)]
|
assert announce_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]]
|
||||||
assert announce_activity.data["object"] == object.data["id"]
|
assert announce_activity.data["object"] == object.data["id"]
|
||||||
assert announce_activity.data["actor"] == user.ap_id
|
assert announce_activity.data["actor"] == user.ap_id
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue