This commit is contained in:
Justin 2022-09-23 09:07:22 -04:00
parent 0576565c83
commit 31b1f3ec97

View file

@ -3,15 +3,17 @@ import { defineMessages, useIntl } from 'react-intl';
import { openModal } from 'soapbox/actions/modals'; import { openModal } from 'soapbox/actions/modals';
import RelativeTimestamp from 'soapbox/components/relative-timestamp'; import RelativeTimestamp from 'soapbox/components/relative-timestamp';
import { Avatar, HStack, Icon, IconButton, Stack, Text } from 'soapbox/components/ui'; import { Avatar, HStack, Icon, Stack, Text } from 'soapbox/components/ui';
import VerificationBadge from 'soapbox/components/verification_badge'; import VerificationBadge from 'soapbox/components/verification_badge';
import DropdownMenuContainer from 'soapbox/containers/dropdown_menu_container'; import DropdownMenuContainer from 'soapbox/containers/dropdown_menu_container';
import { useAppDispatch } from 'soapbox/hooks'; import { useAppDispatch } from 'soapbox/hooks';
import { IChat, IChatSilence, useChat, useChatSilence, useChatSilences } from 'soapbox/queries/chats'; import { IChat, IChatSilence, useChat, useChatSilence } from 'soapbox/queries/chats';
import type { Menu } from 'soapbox/components/dropdown_menu'; import type { Menu } from 'soapbox/components/dropdown_menu';
const messages = defineMessages({ const messages = defineMessages({
silenceNotifications: { id: 'chat_settings.silence_notifications', defaultMessage: 'Silence notifications' },
unsilenceNotifications: { id: 'chat_settings.unsilence_notifications', defaultMessage: 'Unsilence notifications' },
leaveMessage: { id: 'chat_settings.leave.message', defaultMessage: 'Are you sure you want to leave this chat? This conversation will be removed from your inbox.' }, leaveMessage: { id: 'chat_settings.leave.message', defaultMessage: 'Are you sure you want to leave this chat? This conversation will be removed from your inbox.' },
leaveHeading: { id: 'chat_settings.leave.heading', defaultMessage: 'Leave Chat' }, leaveHeading: { id: 'chat_settings.leave.heading', defaultMessage: 'Leave Chat' },
leaveConfirm: { id: 'chat_settings.leave.confirm', defaultMessage: 'Leave Chat' }, leaveConfirm: { id: 'chat_settings.leave.confirm', defaultMessage: 'Leave Chat' },
@ -36,7 +38,7 @@ const ChatListItem: React.FC<IChatListItemInterface> = ({ chat, chatSilence, onC
if (chatSilence) { if (chatSilence) {
menu.push({ menu.push({
text: 'Unsilence notifications', text: intl.formatMessage(messages.unsilenceNotifications),
action: (event) => { action: (event) => {
event.stopPropagation(); event.stopPropagation();
handleSilence(); handleSilence();
@ -45,7 +47,7 @@ const ChatListItem: React.FC<IChatListItemInterface> = ({ chat, chatSilence, onC
}); });
} else { } else {
menu.push({ menu.push({
text: 'Silence notifications', text: intl.formatMessage(messages.silenceNotifications),
action: (event) => { action: (event) => {
event.stopPropagation(); event.stopPropagation();
handleSilence(); handleSilence();