|
|
|
@ -5,10 +5,7 @@ import { Item, Submenu } from 'react-contexify';
|
|
|
|
|
import { ConversationNotificationSettingType } from '../../../models/conversation';
|
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
import { actions as conversationActions } from '../../../state/ducks/conversations';
|
|
|
|
|
import {
|
|
|
|
|
changeNickNameModal,
|
|
|
|
|
updateConfirmModal,
|
|
|
|
|
} from '../../../state/ducks/modalDialog';
|
|
|
|
|
import { changeNickNameModal, updateConfirmModal } from '../../../state/ducks/modalDialog';
|
|
|
|
|
import { getConversationController } from '../../../session/conversations';
|
|
|
|
|
import {
|
|
|
|
|
blockConvoById,
|
|
|
|
@ -129,21 +126,26 @@ export interface PinConversationMenuItemProps {
|
|
|
|
|
conversationId: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const MenuItemPinConversation = (props: PinConversationMenuItemProps): JSX.Element | null => {
|
|
|
|
|
export const MenuItemPinConversation = (
|
|
|
|
|
props: PinConversationMenuItemProps
|
|
|
|
|
): JSX.Element | null => {
|
|
|
|
|
const { conversationId } = props;
|
|
|
|
|
const conversation = getConversationController().get(conversationId).getProps();
|
|
|
|
|
const conversation = getConversationController()
|
|
|
|
|
.get(conversationId)
|
|
|
|
|
.getProps();
|
|
|
|
|
const { isPinned } = conversation;
|
|
|
|
|
|
|
|
|
|
const togglePinConversation = () => {
|
|
|
|
|
window.inboxStore?.dispatch(conversationActions.conversationChanged(conversationId,
|
|
|
|
|
{
|
|
|
|
|
window.inboxStore?.dispatch(
|
|
|
|
|
conversationActions.conversationChanged(conversationId, {
|
|
|
|
|
...conversation,
|
|
|
|
|
isPinned: !isPinned
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
const menuText = isPinned ? window.i18n('unpinConversation'): window.i18n('pinConversation');
|
|
|
|
|
return <Item onClick={togglePinConversation}>{menuText}</Item>
|
|
|
|
|
}
|
|
|
|
|
isPinned: !isPinned,
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
const menuText = isPinned ? window.i18n('unpinConversation') : window.i18n('pinConversation');
|
|
|
|
|
return <Item onClick={togglePinConversation}>{menuText}</Item>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function getDeleteContactMenuItem(
|
|
|
|
|
isMe: boolean | undefined,
|
|
|
|
@ -317,7 +319,7 @@ export function getDisappearingMenuItem(
|
|
|
|
|
// Remove the && false to make context menu work with RTL support
|
|
|
|
|
<Submenu
|
|
|
|
|
label={window.i18n('disappearingMessages') as any}
|
|
|
|
|
// rtl={isRtlMode && false}
|
|
|
|
|
// rtl={isRtlMode && false}
|
|
|
|
|
>
|
|
|
|
|
{(timerOptions || []).map(item => (
|
|
|
|
|
<Item
|
|
|
|
@ -350,7 +352,7 @@ export function getNotificationForConvoMenuItem(
|
|
|
|
|
// Remove the && false to make context menu work with RTL support
|
|
|
|
|
<Submenu
|
|
|
|
|
label={window.i18n('notificationForConvo') as any}
|
|
|
|
|
// rtl={isRtlMode && false}
|
|
|
|
|
// rtl={isRtlMode && false}
|
|
|
|
|
>
|
|
|
|
|
{(notificationForConvoOptions || []).map(item => {
|
|
|
|
|
const disabled = item.value === currentNotificationSetting;
|
|
|
|
|