aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/common_api.ex
diff options
context:
space:
mode:
authorlambda <pleromagit@rogerbraun.net>2018-05-13 09:32:29 +0000
committerlambda <pleromagit@rogerbraun.net>2018-05-13 09:32:29 +0000
commitaeff2d647483d5348cc1da5c901ce55f1c02b733 (patch)
tree7b7db3e9a7e90771fc6f0283605ac390f2bddb45 /lib/pleroma/web/common_api/common_api.ex
parent7e9f14bf3ca95fda9042e10b44b80d8441fa3c42 (diff)
parent54ccbd8479a77f613e8efd9568b3611c28d21742 (diff)
downloadpleroma-aeff2d647483d5348cc1da5c901ce55f1c02b733.tar.gz
Merge branch 'feature/unrepeats' into 'develop'
Add unrepeats Closes #69 See merge request pleroma/pleroma!113
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r--lib/pleroma/web/common_api/common_api.ex10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index 14a68929d..8845419c2 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -24,6 +24,16 @@ defmodule Pleroma.Web.CommonAPI do
end
end
+ def unrepeat(id_or_ap_id, user) do
+ with %Activity{} = activity <- get_by_id_or_ap_id(id_or_ap_id),
+ object <- Object.get_by_ap_id(activity.data["object"]["id"]) do
+ ActivityPub.unannounce(user, object)
+ else
+ _ ->
+ {:error, "Could not unrepeat"}
+ end
+ end
+
def favorite(id_or_ap_id, user) do
with %Activity{} = activity <- get_by_id_or_ap_id(id_or_ap_id),
false <- activity.data["actor"] == user.ap_id,