logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 456f7cab3e20b6affe5c5ed6c04631d5bbac3aca
parent dc912dc5909922f4100c6a56bec72a4bb9e0d5dc
Author: Mark Felder <feld@feld.me>
Date:   Sun, 28 Jan 2024 14:14:26 -0500

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

Diffstat:

Mlib/pleroma/web/pleroma_api/controllers/chat_controller.ex7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -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