|> Map.put("actor_id", ap_id)
|> Map.put("whole_db", true)
- activities =
- ActivityPub.fetch_public_activities(params)
- |> Enum.reverse()
+ if params["pinned"] == "true" do
+ # Since Pleroma has no "pinned" posts feature, we'll just set an empty list here
+ activities = []
+ else
+ activities =
+ ActivityPub.fetch_public_activities(params)
+ |> Enum.reverse()
+ end
conn
|> add_link_headers(:user_statuses, activities, params["id"])
end
end
+ def unreblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
+ with {:ok, _, %{data: %{"id" => id}}} = CommonAPI.unrepeat(ap_id_or_id, user),
+ %Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do
+ render(conn, StatusView, "status.json", %{activity: activity, for: user, as: :activity})
+ end
+ end
+
def fav_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
with {:ok, _fav, %{data: %{"id" => id}}} = CommonAPI.favorite(ap_id_or_id, user),
%Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do
a.data,
^query
),
- limit: 20
+ limit: 20,
+ order_by: [desc: :inserted_at]
)
statuses = Repo.all(q) ++ fetched
"video\/mp4"
]
},
- settings: Map.get(user.info, "settings") || %{
- onboarded: true,
- home: %{
- shows: %{
- reblog: true,
- reply: true
- }
- },
- notifications: %{
- alerts: %{
- follow: true,
- favourite: true,
- reblog: true,
- mention: true
- },
- shows: %{
- follow: true,
- favourite: true,
- reblog: true,
- mention: true
+ settings:
+ Map.get(user.info, "settings") ||
+ %{
+ onboarded: true,
+ home: %{
+ shows: %{
+ reblog: true,
+ reply: true
+ }
+ },
+ notifications: %{
+ alerts: %{
+ follow: true,
+ favourite: true,
+ reblog: true,
+ mention: true
+ },
+ shows: %{
+ follow: true,
+ favourite: true,
+ reblog: true,
+ mention: true
+ },
+ sounds: %{
+ follow: true,
+ favourite: true,
+ reblog: true,
+ mention: true
+ }
+ }
},
- sounds: %{
- follow: true,
- favourite: true,
- reblog: true,
- mention: true
- }
- }
- },
push_subscription: nil,
accounts: accounts,
custom_emojis: mastodon_emoji,
{:ok, _user} <- User.update_and_set_cache(change) do
conn
|> json(%{})
- else e ->
+ else
+ e ->
conn
|> json(%{error: inspect(e)})
end