Merge branch 'develop' into feature/reports-groups-and-multiple-state-update
[akkoma] / lib / pleroma / web / mastodon_api / views / status_view.ex
index 9b8dd30867abfb237dc21cc1bcfcc39574824f8a..baff5415113a7d8230dce1d40d23a5dc16511b4c 100644 (file)
@@ -243,7 +243,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
       end
 
     direct_conversation_id =
-      with {_, true} <- {:include_id, opts[:with_direct_conversation_id]},
+      with {_, nil} <- {:direct_conversation_id, opts[:direct_conversation_id]},
+           {_, true} <- {:include_id, opts[:with_direct_conversation_id]},
            {_, %User{} = for_user} <- {:for_user, opts[:for]},
            %{data: %{"context" => context}} when is_binary(context) <- activity,
            %Conversation{} = conversation <- Conversation.get_for_ap_id(context),
@@ -251,6 +252,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
              Participation.for_user_and_conversation(for_user, conversation) do
         participation_id
       else
+        {:direct_conversation_id, participation_id} when is_integer(participation_id) ->
+          participation_id
+
         _e ->
           nil
       end
@@ -498,6 +502,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
   defp present?(false), do: false
   defp present?(_), do: true
 
-  defp pinned?(%Activity{id: id}, %User{info: %{pinned_activities: pinned_activities}}),
+  defp pinned?(%Activity{id: id}, %User{pinned_activities: pinned_activities}),
     do: id in pinned_activities
 end