From 6bc9e5c020d97edcaaa386bd2ec8e8ec57cb19af Mon Sep 17 00:00:00 2001 From: rinpatch Date: Sat, 1 Jun 2019 21:41:49 +0300 Subject: [PATCH] Mastodon API: Refresh the object before rendering it after voting --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index bab6d693d..8da31161f 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -436,6 +436,8 @@ def poll_vote(%{assigns: %{user: user}} = conn, %{"id" => id, "choices" => choic %Activity{} = activity <- Activity.get_create_by_object_ap_id(object.data["id"]), true <- Visibility.visible_for_user?(activity, user), {:ok, _activities, object} <- CommonAPI.vote(user, object, choices) do + object = Object.get_cached_by_ap_id(object.data["id"]) + conn |> put_view(StatusView) |> try_render("poll.json", %{object: object, for: user})