diff options
author | kaniini <nenolod@gmail.com> | 2019-04-28 00:21:32 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-04-28 00:21:32 +0000 |
commit | f2a4156d4969dee37c88e0d540eff04176673af7 (patch) | |
tree | e569cce24843fb1751996727cc7aa66af14cadb1 /lib/pleroma/web/common_api/common_api.ex | |
parent | 002ea343f8c6dc9669bce91942f835a2c7cc6ae7 (diff) | |
parent | c3e9fcf098e4ec17a387fe264193dca4dda2dd77 (diff) | |
download | pleroma-f2a4156d4969dee37c88e0d540eff04176673af7.tar.gz |
Merge branch 'fix/bookmark-depend-on-embeded-object' into 'develop'
Fix bookmarks depending on embeded object and move checking if the status is bookmarked to SQL
See merge request pleroma/pleroma!1099
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)}, |