fix not being able to pin polls
authorrinpatch <rinpatch@sdf.org>
Sun, 2 Feb 2020 11:55:06 +0000 (14:55 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 8 Feb 2020 22:05:07 +0000 (01:05 +0300)
lib/pleroma/web/common_api/common_api.ex

index 184ec6021d91fc53f48d4fd416d5b9abf1a673ab..01ed7b16ffb83a04aa52f9c189c763b2a87f36d3 100644 (file)
@@ -328,15 +328,10 @@ defmodule Pleroma.Web.CommonAPI do
   def pin(id_or_ap_id, %{ap_id: user_ap_id} = user) do
     with %Activity{
            actor: ^user_ap_id,
-           data: %{
-             "type" => "Create"
-           },
-           object: %Object{
-             data: %{
-               "type" => "Note"
-             }
-           }
+           data: %{"type" => "Create"},
+           object: %Object{data: %{"type" => object_type}}
          } = activity <- get_by_id_or_ap_id(id_or_ap_id),
+         true <- object_type in ["Note", "Article", "Question"],
          true <- Visibility.is_public?(activity),
          %{valid?: true} = info_changeset <- User.Info.add_pinnned_activity(user.info, activity),
          changeset <-