assert status["statusnet_conversation_id"] == retweeted_status["statusnet_conversation_id"]
assert status["retweeted_status"] == retweeted_status
+ assert status["activity_type"] == "repeat"
end
test "a like activity" do
activity_actor = Repo.get_by(User, ap_id: note_activity.data["actor"])
liked_status = ActivityRepresenter.to_map(note_activity, %{user: activity_actor, for: user})
assert liked_status["favorited"] == true
+ assert status["activity_type"] == "like"
end
test "an activity" do
"attachment" => [
object
],
+ "external_url" => "some url",
"like_count" => 5,
"announcement_count" => 3,
"context" => "2hu",
},
"published" => date,
"context" => "2hu"
- }
+ },
+ local: false
}
expected_status = %{
"id" => activity.id,
"user" => UserView.render("show.json", %{user: user, for: follower}),
- "is_local" => true,
+ "is_local" => false,
"statusnet_html" => HtmlSanitizeEx.basic_html(content_html),
"text" => content,
"is_post_verb" => true,
"repeat_num" => 3,
"favorited" => false,
"repeated" => false,
- "external_url" => activity.data["id"],
- "tags" => ["content", "mentioning", "nsfw"]
+ "external_url" => "some url",
+ "tags" => ["content", "mentioning", "nsfw"],
+ "activity_type" => "post"
}
assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status
end
+
+ test "an undo for a follow" do
+ follower = insert(:user)
+ followed = insert(:user)
+
+ {:ok, follow} = ActivityPub.follow(follower, followed)
+ {:ok, unfollow} = ActivityPub.unfollow(follower, followed)
+
+ map = ActivityRepresenter.to_map(unfollow, %{user: follower})
+ assert map["is_post_verb"] == false
+ assert map["activity_type"] == "undo"
+ end
end