|
|
@@ -338,7 +338,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |
|
|
|
end |
|
|
|
|
|
|
|
def get_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do |
|
|
|
with %Activity{} = activity <- Activity.get_by_id(id), |
|
|
|
with %Activity{} = activity <- Activity.get_by_id_with_object(id), |
|
|
|
true <- Visibility.visible_for_user?(activity, user) do |
|
|
|
conn |
|
|
|
|> put_view(StatusView) |
|
|
@@ -487,7 +487,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |
|
|
|
end |
|
|
|
|
|
|
|
def reblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do |
|
|
|
with {:ok, announce, _activity} <- CommonAPI.repeat(ap_id_or_id, user) do |
|
|
|
with {:ok, announce, _activity} <- CommonAPI.repeat(ap_id_or_id, user), |
|
|
|
%Activity{} = announce <- Activity.normalize(announce.data) do |
|
|
|
conn |
|
|
|
|> put_view(StatusView) |
|
|
|
|> try_render("status.json", %{activity: announce, for: user, as: :activity}) |
|
|
@@ -496,7 +497,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |
|
|
|
|
|
|
|
def unreblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do |
|
|
|
with {:ok, _unannounce, %{data: %{"id" => id}}} <- CommonAPI.unrepeat(ap_id_or_id, user), |
|
|
|
%Activity{} = activity <- Activity.get_create_by_object_ap_id(id) do |
|
|
|
%Activity{} = activity <- Activity.get_create_by_object_ap_id_with_object(id) do |
|
|
|
conn |
|
|
|
|> put_view(StatusView) |
|
|
|
|> try_render("status.json", %{activity: activity, for: user, as: :activity}) |
|
|
|