Fix unbookmarking
authorrinpatch <rinpatch@sdf.org>
Wed, 17 Apr 2019 11:27:02 +0000 (14:27 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 17 Apr 2019 11:27:02 +0000 (14:27 +0300)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index d2e3da4496bb12e646201f1ba15b09dd2b9f08ba..1e82b2f685d08ee604c0220b9bafcbab20b56744 100644 (file)
@@ -555,10 +555,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   end
 
   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),
          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
       |> put_view(StatusView)
       |> try_render("status.json", %{activity: activity, for: user, as: :activity})