content_html = add_user_links(content, mentions)
+ date = make_date()
+
activity = %{
"type" => "Create",
"to" => to,
"type" => "Note",
"to" => to,
"content" => content_html,
- "published" => make_date,
+ "published" => date,
"context" => context,
"attachment" => attachments
},
- "published" => make_date,
+ "published" => date,
"context" => context
}
end
def fetch_friend_statuses(user, opts \\ %{}) do
- ActivityPub.fetch_activities(user.following, opts)
+ ActivityPub.fetch_activities([user.ap_id | user.following], opts)
|> activities_to_statuses(%{for: user})
end
def follow(%User{} = follower, followed_id) do
with %User{} = followed <- Repo.get(User, followed_id),
- { :ok, follower } <- User.follow(follower, followed),
+ { :ok, follower } <- User.follow(follower, followed),
{ :ok, activity } <- ActivityPub.insert(%{
"type" => "Follow",
"actor" => follower.ap_id,
"object" => followed.ap_id,
- "published" => make_date
+ "published" => make_date()
})
do
{ :ok, follower, followed, activity }
+ else
+ err -> err
end
end
{ :ok, follower } <- User.unfollow(follower, followed)
do
{ :ok, follower, followed }
+ else
+ err -> err
end
end