Fix task name for robotstxt
[akkoma] / lib / pleroma / web / common_api / utils.ex
index bf03b0a8253fec9cf6b47b27df7a9dddd316ab4a..aee19a840de04aa2c1cc9e5d1e73a0a6299557f7 100644 (file)
@@ -17,7 +17,6 @@ defmodule Pleroma.Web.CommonAPI.Utils do
   alias Pleroma.Web.ActivityPub.Visibility
   alias Pleroma.Web.CommonAPI.ActivityDraft
   alias Pleroma.Web.MediaProxy
-  alias Pleroma.Web.Plugs.AuthenticationPlug
   alias Pleroma.Web.Utils.Params
 
   require Logger
@@ -231,12 +230,13 @@ defmodule Pleroma.Web.CommonAPI.Utils do
     end
   end
 
-  def make_context(_, %Participation{} = participation) do
+  def make_context(%{in_reply_to_conversation: %Participation{} = participation}) do
     Repo.preload(participation, :conversation).conversation.ap_id
   end
 
-  def make_context(%Activity{data: %{"context" => context}}, _), do: context
-  def make_context(_, _), do: Utils.generate_context_id()
+  def make_context(%{in_reply_to: %Activity{data: %{"context" => context}}}), do: context
+  def make_context(%{quote: %Activity{data: %{"context" => context}}}), do: context
+  def make_context(_), do: Utils.generate_context_id()
 
   def maybe_add_attachments(parsed, _attachments, false = _no_links), do: parsed
 
@@ -356,7 +356,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
   @spec confirm_current_password(User.t(), String.t()) :: {:ok, User.t()} | {:error, String.t()}
   def confirm_current_password(user, password) do
     with %User{local: true} = db_user <- User.get_cached_by_id(user.id),
-         true <- AuthenticationPlug.checkpw(password, db_user.password_hash) do
+         true <- Pleroma.Password.checkpw(password, db_user.password_hash) do
       {:ok, db_user}
     else
       _ -> {:error, dgettext("errors", "Invalid password.")}