fix: Handle the case where message has no attachments (#9902)

Fix the broken message sending due to the errors in attachment update PR
https://github.com/chatwoot/chatwoot/pull/9784

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
Pranav 2024-08-06 21:27:12 -07:00 committed by GitHub
parent aea68f1ecf
commit c344f2b9cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,7 +146,10 @@ export const mutations = {
[types.ADD_CONVERSATION_ATTACHMENTS](_state, message) {
// early return if the message has not been sent, or has no attachments
if (message.status !== MESSAGE_STATUS.SENT || !message.attachments.length) {
if (
message.status !== MESSAGE_STATUS.SENT ||
!message.attachments?.length
) {
return;
}