1 defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
3 alias Pleroma.Web.ActivityPub.ActivityPub
5 alias Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter
7 def create_status(user = %User{}, data = %{}) do
11 User.ap_followers(user),
12 "https://www.w3.org/ns/activitystreams#Public"
14 "actor" => User.ap_id(user),
17 "content" => data["status"]
21 ActivityPub.insert(activity)
24 def fetch_public_statuses do
25 activities = ActivityPub.fetch_public_activities
27 Enum.map(activities, fn(activity) ->
28 actor = get_in(activity.data, ["actor"])
29 user = Repo.get_by!(User, ap_id: actor)
30 ActivityRepresenter.to_map(activity, %{user: user})