diff options
author | rinpatch <rinpatch@sdf.org> | 2019-04-27 23:06:46 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-04-27 23:06:46 +0300 |
commit | c3e9fcf098e4ec17a387fe264193dca4dda2dd77 (patch) | |
tree | e569cce24843fb1751996727cc7aa66af14cadb1 /lib/pleroma/web/common_api/common_api.ex | |
parent | 002ea343f8c6dc9669bce91942f835a2c7cc6ae7 (diff) | |
download | pleroma-c3e9fcf098e4ec17a387fe264193dca4dda2dd77.tar.gz |
Fix bookmarks depending on embeded object and move checking if the
status is bookmarked to SQL
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 10 |
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 cfbc5dc10..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,6 +283,15 @@ 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_cached_by_id(account_id)}, |