kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Fix sending chat messages
Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1752environments/review-fix-chats-g3m4o9/deployments/4900
rodzic
d2ff5cf64e
commit
5f9cede2ac
|
@ -96,7 +96,7 @@ const Chat: React.FC<ChatInterface> = ({ chat, inputRef, className }) => {
|
||||||
if (!isSubmitDisabled && !createChatMessage.isPending) {
|
if (!isSubmitDisabled && !createChatMessage.isPending) {
|
||||||
submitMessage();
|
submitMessage();
|
||||||
|
|
||||||
if (!chat.accepted) {
|
if (chat.accepted === false) {
|
||||||
acceptChat.mutate();
|
acceptChat.mutate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,8 +294,7 @@ const useChatActions = (chatId: string) => {
|
||||||
onError: (_error: any, variables, context: any) => {
|
onError: (_error: any, variables, context: any) => {
|
||||||
queryClient.setQueryData(['chats', 'messages', variables.chatId], context.prevChatMessages);
|
queryClient.setQueryData(['chats', 'messages', variables.chatId], context.prevChatMessages);
|
||||||
},
|
},
|
||||||
onSuccess: async (response, variables, context) => {
|
onSuccess: (data, variables, context) => {
|
||||||
const data = await response.json();
|
|
||||||
const nextChat = { ...chat, last_message: data };
|
const nextChat = { ...chat, last_message: data };
|
||||||
updatePageItem(ChatKeys.chatSearch(), nextChat, (o, n) => o.id === n.id);
|
updatePageItem(ChatKeys.chatSearch(), nextChat, (o, n) => o.id === n.id);
|
||||||
updatePageItem(
|
updatePageItem(
|
||||||
|
|
Ładowanie…
Reference in New Issue