diff --git a/app/soapbox/features/chats/components/chat-list-item.tsx b/app/soapbox/features/chats/components/chat-list-item.tsx index b091187b2..762270505 100644 --- a/app/soapbox/features/chats/components/chat-list-item.tsx +++ b/app/soapbox/features/chats/components/chat-list-item.tsx @@ -7,7 +7,7 @@ import { Avatar, HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import VerificationBadge from 'soapbox/components/verification_badge'; import DropdownMenuContainer from 'soapbox/containers/dropdown_menu_container'; import { useAppDispatch } from 'soapbox/hooks'; -import { IChat, IChatSilence, useChat, useChatSilence } from 'soapbox/queries/chats'; +import { IChat, IChatSilence, useChatActions, useChatSilence } from 'soapbox/queries/chats'; import type { Menu } from 'soapbox/components/dropdown_menu'; @@ -31,7 +31,7 @@ const ChatListItem: React.FC = ({ chat, chatSilence, onC const intl = useIntl(); const { handleSilence } = useChatSilence(chat); - const { deleteChat } = useChat(chat?.id as string); + const { deleteChat } = useChatActions(chat?.id as string); const menu = useMemo((): Menu => { const menu: Menu = []; diff --git a/app/soapbox/features/chats/components/chat-message-list-intro.tsx b/app/soapbox/features/chats/components/chat-message-list-intro.tsx index 309a018de..790bd5188 100644 --- a/app/soapbox/features/chats/components/chat-message-list-intro.tsx +++ b/app/soapbox/features/chats/components/chat-message-list-intro.tsx @@ -7,7 +7,7 @@ import { initReport } from 'soapbox/actions/reports'; import { Avatar, Button, HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch } from 'soapbox/hooks'; -import { useChat } from 'soapbox/queries/chats'; +import { useChatActions } from 'soapbox/queries/chats'; const messages = defineMessages({ leaveChatHeading: { id: 'chat_message_list_intro.leave_chat.heading', defaultMessage: 'Leave Chat' }, @@ -25,7 +25,7 @@ const ChatMessageListIntro = () => { const intl = useIntl(); const { chat, needsAcceptance } = useChatContext(); - const { acceptChat, deleteChat } = useChat(chat?.id as string); + const { acceptChat, deleteChat } = useChatActions(chat?.id as string); const handleLeaveChat = () => { dispatch(openModal('CONFIRM', { diff --git a/app/soapbox/features/chats/components/chat-message-list.tsx b/app/soapbox/features/chats/components/chat-message-list.tsx index 3f842bf35..31810dfb9 100644 --- a/app/soapbox/features/chats/components/chat-message-list.tsx +++ b/app/soapbox/features/chats/components/chat-message-list.tsx @@ -14,7 +14,7 @@ import PlaceholderChatMessage from 'soapbox/features/placeholder/components/plac import Bundle from 'soapbox/features/ui/components/bundle'; import { MediaGallery } from 'soapbox/features/ui/util/async-components'; import { useAppSelector, useAppDispatch, useOwnAccount } from 'soapbox/hooks'; -import { chatKeys, IChat, IChatMessage, useChat, useChatMessages } from 'soapbox/queries/chats'; +import { chatKeys, IChat, IChatMessage, useChatActions, useChatMessages } from 'soapbox/queries/chats'; import { queryClient } from 'soapbox/queries/client'; import { onlyEmoji } from 'soapbox/utils/rich_content'; @@ -72,7 +72,7 @@ const ChatMessageList: React.FC = ({ chat, autosize }) => { const [initialLoad, setInitialLoad] = useState(true); const [scrollPosition, setScrollPosition] = useState(0); - const { deleteChatMessage, markChatAsRead } = useChat(chat.id); + const { deleteChatMessage, markChatAsRead } = useChatActions(chat.id); const { data: chatMessages, fetchNextPage, diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx index 3f2798c92..87d37e6bd 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx @@ -9,7 +9,7 @@ import { Avatar, Divider, HStack, Icon, IconButton, Menu, MenuButton, MenuItem, import VerificationBadge from 'soapbox/components/verification_badge'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch, useOwnAccount } from 'soapbox/hooks'; -import { useChat, useChatSilence } from 'soapbox/queries/chats'; +import { useChatActions, useChatSilence } from 'soapbox/queries/chats'; import Chat from '../../chat'; @@ -34,7 +34,7 @@ const ChatPageMain = () => { const { chat, setChat } = useChatContext(); const { isSilenced, handleSilence, fetchChatSilence } = useChatSilence(chat); - const { deleteChat } = useChat(chat?.id as string); + const { deleteChat } = useChatActions(chat?.id as string); const handleBlockUser = () => { dispatch(openModal('CONFIRM', { diff --git a/app/soapbox/features/chats/components/chat-settings.tsx b/app/soapbox/features/chats/components/chat-settings.tsx index 69dfbecd6..6d416b319 100644 --- a/app/soapbox/features/chats/components/chat-settings.tsx +++ b/app/soapbox/features/chats/components/chat-settings.tsx @@ -8,7 +8,7 @@ import List, { ListItem } from 'soapbox/components/list'; import { Avatar, Divider, HStack, Icon, Stack, Text, Toggle } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch } from 'soapbox/hooks'; -import { useChat, useChatSilence } from 'soapbox/queries/chats'; +import { useChatActions, useChatSilence } from 'soapbox/queries/chats'; import ChatPaneHeader from './chat-pane-header'; @@ -32,7 +32,7 @@ const ChatSettings = () => { const { chat, setEditing, toggleChatPane } = useChatContext(); const { isSilenced, handleSilence, fetchChatSilence } = useChatSilence(chat); - const { deleteChat } = useChat(chat?.id as string); + const { deleteChat } = useChatActions(chat?.id as string); const closeSettings = () => setEditing(false); diff --git a/app/soapbox/features/chats/components/chat.tsx b/app/soapbox/features/chats/components/chat.tsx index 2dba86f95..8ab70d1d8 100644 --- a/app/soapbox/features/chats/components/chat.tsx +++ b/app/soapbox/features/chats/components/chat.tsx @@ -8,7 +8,7 @@ import { HStack, IconButton, Stack, Text, Textarea } from 'soapbox/components/ui import UploadProgress from 'soapbox/components/upload-progress'; import UploadButton from 'soapbox/features/compose/components/upload_button'; import { useAppDispatch, useOwnAccount } from 'soapbox/hooks'; -import { chatKeys, IChat, useChat } from 'soapbox/queries/chats'; +import { chatKeys, IChat, useChatActions } from 'soapbox/queries/chats'; import { queryClient } from 'soapbox/queries/client'; import { truncateFilename } from 'soapbox/utils/media'; @@ -39,7 +39,7 @@ const Chat: React.FC = ({ chat, autosize, inputRef, className }) const dispatch = useAppDispatch(); const account = useOwnAccount(); - const { createChatMessage, acceptChat } = useChat(chat.id); + const { createChatMessage, acceptChat } = useChatActions(chat.id); const [content, setContent] = useState(''); const [attachment, setAttachment] = useState(undefined); diff --git a/app/soapbox/queries/chats.ts b/app/soapbox/queries/chats.ts index 0d750fb46..ede4b5714 100644 --- a/app/soapbox/queries/chats.ts +++ b/app/soapbox/queries/chats.ts @@ -155,7 +155,7 @@ const useChats = (search?: string) => { return { chatsQuery, getOrCreateChatByAccountId }; }; -const useChat = (chatId: string) => { +const useChatActions = (chatId: string) => { const api = useApi(); const { setChat, setEditing } = useChatContext(); @@ -264,4 +264,4 @@ const useChatSilence = (chat: IChat | null) => { return { isSilenced, handleSilence, fetchChatSilence }; }; -export { chatKeys, useChat, useChats, useChatMessages, useChatSilences, useChatSilence }; +export { chatKeys, useChatActions, useChats, useChatMessages, useChatSilences, useChatSilence };