aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/common_api.ex
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@gmail.com>2019-04-30 20:17:52 +0700
committerRoman Chvanikov <chvanikoff@gmail.com>2019-04-30 20:17:52 +0700
commit0f0cc2703b7ffb99c58e72782925ea4dd61db41d (patch)
treef640d180d16797a6da98a7d1e1cb7c6fb6350392 /lib/pleroma/web/common_api/common_api.ex
parentb87ad13803df59d88feb736c3d0ff9cf514989d7 (diff)
parent32a4501d2d1cdfef68cbde236482e0c84cce3a7a (diff)
downloadpleroma-0f0cc2703b7ffb99c58e72782925ea4dd61db41d.tar.gz
Merge develop
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r--lib/pleroma/web/common_api/common_api.ex12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index 6458a3449..ecd183110 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -4,6 +4,7 @@
defmodule Pleroma.Web.CommonAPI do
alias Pleroma.Activity
+ alias Pleroma.Bookmark
alias Pleroma.Formatter
alias Pleroma.Object
alias Pleroma.ThreadMute
@@ -282,9 +283,18 @@ defmodule Pleroma.Web.CommonAPI do
end
end
+ def bookmarked?(user, activity) do
+ with %Bookmark{} <- Bookmark.get(user.id, activity.id) do
+ true
+ else
+ _ ->
+ false
+ end
+ end
+
def report(user, data) do
with {:account_id, %{"account_id" => account_id}} <- {:account_id, data},
- {:account, %User{} = account} <- {:account, User.get_by_id(account_id)},
+ {:account, %User{} = account} <- {:account, User.get_cached_by_id(account_id)},
{:ok, {content_html, _, _}} <- make_report_content_html(data["comment"]),
{:ok, statuses} <- get_report_statuses(account, data),
{:ok, activity} <-