X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Ftwitter_api%2Ftwitter_api.ex;h=f4ab5bdc6902b4c4e1fbfdc297bd0ea0ab58141f;hb=a8e50d602ba25b2062e0e676e1dd115da64c2565;hp=932bef5efa7a5127d14cc96bdbadb7550b7346a8;hpb=8f43992121a726df2faaf04bf918f32f708d10f8;p=akkoma diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index 932bef5ef..f4ab5bdc6 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -25,6 +25,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do content_html = add_user_links(content, mentions) + date = make_date() + activity = %{ "type" => "Create", "to" => to, @@ -33,11 +35,11 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do "type" => "Note", "to" => to, "content" => content_html, - "published" => make_date, + "published" => date, "context" => context, "attachment" => attachments }, - "published" => make_date, + "published" => date, "context" => context } @@ -67,7 +69,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do 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 @@ -101,15 +103,17 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do 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 @@ -118,6 +122,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do { :ok, follower } <- User.unfollow(follower, followed) do { :ok, follower, followed } + else + err -> err end end