diff --git a/src/views/app/detail-panel/edit/edit-view.jsx b/src/views/app/detail-panel/edit/edit-view.jsx index 1f2b619fd..c87e0b23b 100644 --- a/src/views/app/detail-panel/edit/edit-view.jsx +++ b/src/views/app/detail-panel/edit/edit-view.jsx @@ -289,10 +289,10 @@ export default function EditView({ mailId, folderId, setHeader, toggleAppBoard } }, [account, accounts, defaultIdentity?.address, defaultIdentity?.fullname, t, updateEditorCb]); useEffect(() => { - if (activeMailId) { + if (activeMailId && !messages[activeMailId]?.isComplete) { dispatch(getMsg({ msgId: activeMailId })); } - }, [activeMailId, dispatch]); + }, [activeMailId, dispatch, messages, updateEditorCb]); const sendMailCb = useCallback(() => { setBtnSendLabel(t('label.sending', 'Sending')); @@ -474,28 +474,30 @@ export default function EditView({ mailId, folderId, setHeader, toggleAppBoard } }, [editor?.subject, setHeader, updateBoard, action, t]); useEffect(() => { - if (!editors[editorId]) { - dispatch( - createEditor({ - settings, - editorId, - id: action === ActionsType.EDIT_AS_DRAFT ? activeMailId : undefined, - original: messages[activeMailId ?? editorId], - boardContext, - action, - change, - accounts, - labels: { - to: `${t('label.to', 'To')}:`, - from: `${t('label.from', 'From')}:`, - cc: `${t('label.cc', 'CC')}:`, - subject: `${t('label.subject', 'Subject')}:`, - sent: `${t('label.sent', 'Sent')}:` - } - }) - ); - } else { - setEditor(editors[editorId]); + if (activeMailId && messages[activeMailId]?.isComplete) { + if (!editors[editorId]) { + dispatch( + createEditor({ + settings, + editorId, + id: action === ActionsType.EDIT_AS_DRAFT ? activeMailId : undefined, + original: messages[activeMailId ?? editorId], + boardContext, + action, + change, + accounts, + labels: { + to: `${t('label.to', 'To')}:`, + from: `${t('label.from', 'From')}:`, + cc: `${t('label.cc', 'CC')}:`, + subject: `${t('label.subject', 'Subject')}:`, + sent: `${t('label.sent', 'Sent')}:` + } + }) + ); + } else { + setEditor(editors[editorId]); + } } }, [ editors, @@ -574,6 +576,7 @@ export default function EditView({ mailId, folderId, setHeader, toggleAppBoard } const participants = concat(editor?.to, editor?.bcc, editor?.cc); return btnSendDisabled || participants.length === 0 || some(participants, { error: true }); }, [btnSendDisabled, editor]); + return editor ? ( onDragOverEvent(event)}> diff --git a/src/views/app/folder-panel/lists-item/conversation-list-item.jsx b/src/views/app/folder-panel/lists-item/conversation-list-item.jsx index f4bda759c..f597d0c99 100644 --- a/src/views/app/folder-panel/lists-item/conversation-list-item.jsx +++ b/src/views/app/folder-panel/lists-item/conversation-list-item.jsx @@ -224,6 +224,7 @@ export default function ConversationListItem({ item.messages, (acc, v) => { const msg = find(messages, ['id', v.id]); + if (msg) { // in trash we show all messages of the conversation even if only one is deleted if (folderId === FOLDERS.TRASH) { @@ -284,6 +285,7 @@ export default function ConversationListItem({ onDoubleClick={_onDoubleClick} hoverTooltipLabel={participantsString} isConversation + messagesToRender={messagesToRender} >
{ const { getMessageActions, getConversationActions } = useContext(ActionsContext); - const [hoverActions, dropdownActions] = useMemo( - () => (isConversation ? getConversationActions(item) : getMessageActions(item)), - [isConversation, getConversationActions, item, getMessageActions] - ); + + const [hoverActions, dropdownActions] = useMemo(() => { + if (isConversation) { + return messagesToRender?.length > 1 + ? getConversationActions(item) + : getMessageActions({ ...item, ...messagesToRender[0] }); + } + return getMessageActions(item); + }, [isConversation, getMessageActions, item, messagesToRender, getConversationActions]); return (