fix: inconsistent reply box cc update (#10799)

This PR target two issues

### CC & BCC not updated correctly

When moving from one conversation to another, the store may not have the
list of all the messages. A fetch is subsequently made to get the
messages. However, this update does not trigger the `currentChat`
watcher. This PR fixes it by adding a new watcher on
`currentChat.messages`.

We also update the `setCCAndToEmailsFromLastChat` method to reset the
`cc`, `bcc` and `to` fields if the last email is not found. This ensures
that the data is not carried forward from a previous email

Fixes: https://github.com/chatwoot/chatwoot/issues/10477

### To address are not added correctly to the `CC`

If the `to` address of a previous email has multiple recipient, there
was no case to add them to the CC.

Fixes: https://github.com/chatwoot/chatwoot/issues/8925

---

Depends on: https://github.com/chatwoot/utils/pull/41
This commit is contained in:
Shivam Mishra
2025-02-11 17:45:59 +05:30
committed by GitHub
parent a428dfc3f4
commit 84822a013a
4 changed files with 48 additions and 57 deletions

28
pnpm-lock.yaml generated
View File

@@ -23,8 +23,8 @@ importers:
specifier: 1.1.1-next
version: 1.1.1-next
'@chatwoot/utils':
specifier: ^0.0.35
version: 0.0.35
specifier: ^0.0.38
version: 0.0.38
'@formkit/core':
specifier: ^1.6.7
version: 1.6.7
@@ -376,6 +376,10 @@ packages:
resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==}
engines: {node: '>=6.9.0'}
'@babel/runtime@7.26.7':
resolution: {integrity: sha512-AOPI3D+a8dXnja+iwsUqGRjr1BbZIe771sXdapOtYI531gSqpi92vXivKcq2asu/DFpdl1ceFAKZyRzK2PCVcQ==}
engines: {node: '>=6.9.0'}
'@babel/types@7.26.0':
resolution: {integrity: sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==}
engines: {node: '>=6.9.0'}
@@ -393,8 +397,8 @@ packages:
'@chatwoot/prosemirror-schema@1.1.1-next':
resolution: {integrity: sha512-/M2qZ+ZF7GlQNt1riwVP499fvp3hxSqd5iy8hxyF9pkj9qQ+OKYn5JK+v3qwwqQY3IxhmNOn1Lp6tm7vstrd9Q==}
'@chatwoot/utils@0.0.35':
resolution: {integrity: sha512-uSRbd3pFp+IcEhsRtK1XGcFGFJc+X/YIwQnQrVDXsvsX3Mm7HEANj+Yz6J2clfHotajniwJwH2u5/y48+JrTyA==}
'@chatwoot/utils@0.0.38':
resolution: {integrity: sha512-6CTvuueBQLZJcm++pI2ZBY8Pp7OP3WzPCYyXoCagl8ZLpOfpjyVkLx9fc81falOoaVa/r+7EZ85Cv7vkT0ZyQw==}
engines: {node: '>=10'}
'@codemirror/commands@6.7.0':
@@ -2372,8 +2376,8 @@ packages:
resolution: {integrity: sha512-m1WR0xGiC6j6jNFAyW4Nvh4WxAi4JF4w9jRJwSI8nBmNcyZXPcP9VUQG+6gHQXAmqaGEKDKhOqAtENDC941UkA==}
engines: {node: '>=0.11'}
date-fns@2.29.3:
resolution: {integrity: sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==}
date-fns@2.30.0:
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
engines: {node: '>=0.11'}
date-format-parse@0.2.7:
@@ -5092,6 +5096,10 @@ snapshots:
dependencies:
regenerator-runtime: 0.14.1
'@babel/runtime@7.26.7':
dependencies:
regenerator-runtime: 0.14.1
'@babel/types@7.26.0':
dependencies:
'@babel/helper-string-parser': 7.25.9
@@ -5125,9 +5133,9 @@ snapshots:
prosemirror-utils: 1.2.2(prosemirror-model@1.22.3)(prosemirror-state@1.4.3)
prosemirror-view: 1.34.1
'@chatwoot/utils@0.0.35':
'@chatwoot/utils@0.0.38':
dependencies:
date-fns: 2.29.3
date-fns: 2.30.0
'@codemirror/commands@6.7.0':
dependencies:
@@ -7380,7 +7388,9 @@ snapshots:
date-fns@2.21.1: {}
date-fns@2.29.3: {}
date-fns@2.30.0:
dependencies:
'@babel/runtime': 7.26.7
date-format-parse@0.2.7: {}