Pleroma.Web.PleromaAPI.ChatController: Dialyzer errors

lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:91:pattern_match
The pattern can never match the type.

Pattern:
{:reject, _message}

Type:
nil

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:96:pattern_match
The pattern can never match the type.

Pattern:
{:error, _message}

Type:
nil
This commit is contained in:
Mark Felder 2024-01-28 14:14:26 -05:00
parent dc912dc590
commit 456f7cab3e

View File

@ -76,7 +76,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
%{id: id}
) do
with {:ok, chat} <- Chat.get_by_user_and_id(user, id),
%User{} = recipient <- User.get_cached_by_ap_id(chat.recipient),
{_, %User{} = recipient} <- {:user, User.get_cached_by_ap_id(chat.recipient)},
{:ok, activity} <-
CommonAPI.post_chat_message(user, recipient, params[:content],
media_id: params[:media_id],
@ -97,6 +97,11 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
conn
|> put_status(:bad_request)
|> json(%{error: message})
{:user, nil} ->
conn
|> put_status(:bad_request)
|> json(%{error: "Recipient does not exist"})
end
end