useChat --> useChatActions
This commit is contained in:
parent
9c43f4b51e
commit
3ce5925280
7 changed files with 14 additions and 14 deletions
|
@ -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<IChatListItemInterface> = ({ 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 = [];
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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<IChatMessageList> = ({ 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,
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<ChatInterface> = ({ 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<string>('');
|
||||
const [attachment, setAttachment] = useState<any>(undefined);
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Reference in a new issue