aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/common_api.ex
diff options
context:
space:
mode:
authorSachin Joshi <satchin.joshi@gmail.com>2019-05-01 00:21:30 +0545
committerSachin Joshi <satchin.joshi@gmail.com>2019-05-01 00:21:30 +0545
commitcd6da3606b0170b1a5c7d64b96f1621896cc0930 (patch)
tree76086dd4145017de644bdeb17a389bb4d8c7a298 /lib/pleroma/web/common_api/common_api.ex
parent963d5774af7efb57fa306b3ac164049f8958a72c (diff)
parent77690b9d03facf74483e3379f72b5b51c9f1bd4e (diff)
downloadpleroma-cd6da3606b0170b1a5c7d64b96f1621896cc0930.tar.gz
Merge branch 'develop' into bugfix/web-notification-special-char
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} <-