fix(announcements): error message not showing when an event announcement is created with empty text

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2024-01-09 15:49:03 +01:00
parent 9207d76712
commit ef20585f8c
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 8 additions and 1 deletions

View file

@ -156,6 +156,9 @@ defmodule Mobilizon.GraphQL.Resolvers.Conversation do
{:ok, conversation_to_view(conversation, conversation_participant_actor)} {:ok, conversation_to_view(conversation, conversation_participant_actor)}
{:error, %Ecto.Changeset{} = changeset} ->
{:error, changeset}
{:error, :empty_participants} -> {:error, :empty_participants} ->
{:error, {:error,
dgettext( dgettext(

View file

@ -133,6 +133,7 @@ const sendForm = (e: Event) => {
e.preventDefault(); e.preventDefault();
console.debug("Sending new private message"); console.debug("Sending new private message");
if (!currentActor.value?.id || !event.value.id) return; if (!currentActor.value?.id || !event.value.id) return;
errors.value = [];
eventPrivateMessageMutate({ eventPrivateMessageMutate({
text: text.value, text: text.value,
actorId: actorId:
@ -150,7 +151,10 @@ onEventPrivateMessageMutated(() => {
onEventPrivateMessageError((err) => { onEventPrivateMessageError((err) => {
err.graphQLErrors.forEach((error) => { err.graphQLErrors.forEach((error) => {
errors.value.push(error.message); const message = Array.isArray(error.message)
? error.message
: [error.message];
errors.value.push(...message);
}); });
}); });