forked from AkkomaGang/akkoma
Fix unbookmarking
This commit is contained in:
parent
e7c3c36766
commit
e641651e2b
1 changed files with 3 additions and 2 deletions
|
@ -555,10 +555,11 @@ def bookmark_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def unbookmark_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
def unbookmark_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||||
with %Activity{} = activity <- Activity.get_by_id(id),
|
with %Activity{} = activity <- Activity.get_by_id_with_object(id),
|
||||||
|
%Object{} = object <- Object.normalize(activity),
|
||||||
%User{} = user <- User.get_by_nickname(user.nickname),
|
%User{} = user <- User.get_by_nickname(user.nickname),
|
||||||
true <- Visibility.visible_for_user?(activity, user),
|
true <- Visibility.visible_for_user?(activity, user),
|
||||||
{:ok, user} <- User.unbookmark(user, activity.data["object"]["id"]) do
|
{:ok, user} <- User.unbookmark(user, object.data["id"]) do
|
||||||
conn
|
conn
|
||||||
|> put_view(StatusView)
|
|> put_view(StatusView)
|
||||||
|> try_render("status.json", %{activity: activity, for: user, as: :activity})
|
|> try_render("status.json", %{activity: activity, for: user, as: :activity})
|
||||||
|
|
Loading…
Reference in a new issue