Merge branch 'fix-chats-send' into 'main'

Fix sending chat messages

Closes #1752

See merge request soapbox-pub/soapbox!3153
environments/review-main-yi2y9f/deployments/4901
Alex Gleason 2024-10-13 18:58:04 +00:00
commit a31234e8a1
2 zmienionych plików z 2 dodań i 3 usunięć

Wyświetl plik

@ -96,7 +96,7 @@ const Chat: React.FC<ChatInterface> = ({ chat, inputRef, className }) => {
if (!isSubmitDisabled && !createChatMessage.isPending) {
submitMessage();
if (!chat.accepted) {
if (chat.accepted === false) {
acceptChat.mutate();
}
}

Wyświetl plik

@ -294,8 +294,7 @@ const useChatActions = (chatId: string) => {
onError: (_error: any, variables, context: any) => {
queryClient.setQueryData(['chats', 'messages', variables.chatId], context.prevChatMessages);
},
onSuccess: async (response, variables, context) => {
const data = await response.json();
onSuccess: (data, variables, context) => {
const nextChat = { ...chat, last_message: data };
updatePageItem(ChatKeys.chatSearch(), nextChat, (o, n) => o.id === n.id);
updatePageItem(