aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-05 16:42:34 +0200
committerlain <lain@soykaf.club>2020-05-05 16:42:34 +0200
commita3bb2e5474ee068bf375b24df8906e51654c9699 (patch)
tree2e155d1608ea4ef8059d5a204b45d5f361c9e940 /lib/pleroma/web/common_api
parentb34debe61540cf845ccf4ac93066e45a1d9c8f85 (diff)
downloadpleroma-a3bb2e5474ee068bf375b24df8906e51654c9699.tar.gz
Undoing: Move undoing announcements to the pipeline everywhere.
Diffstat (limited to 'lib/pleroma/web/common_api')
-rw-r--r--lib/pleroma/web/common_api/common_api.ex9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index 067ac875e..fc8246871 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -107,9 +107,12 @@ defmodule Pleroma.Web.CommonAPI do
def unrepeat(id, user) do
with {_, %Activity{data: %{"type" => "Create"}} = activity} <-
- {:find_activity, Activity.get_by_id(id)} do
- object = Object.normalize(activity)
- ActivityPub.unannounce(user, object)
+ {:find_activity, Activity.get_by_id(id)},
+ %Object{} = note <- Object.normalize(activity, false),
+ %Activity{} = announce <- Utils.get_existing_announce(user.ap_id, note),
+ {:ok, undo, _} <- Builder.undo(user, announce),
+ {:ok, activity, _} <- Pipeline.common_pipeline(undo, local: true) do
+ {:ok, activity}
else
{:find_activity, _} -> {:error, :not_found}
_ -> {:error, dgettext("errors", "Could not unrepeat")}