fix: sentry issues (#10695)

1. Ensure audio player ref is accessible before triggering calls
([Sentry](https://chatwoot-p3.sentry.io/issues/6221981610))
2. Use correct default for attachments, this was incorrectly set to
`null` in a previous PR
([Sentry](https://chatwoot-p3.sentry.io/issues/5966738120))
3. Fix `lastNonActivityMessage` is not present
([Sentry](https://chatwoot-p3.sentry.io/issues/6116038455))
4. Fix `Alt+J` & `Alt+K` shortcuts not working
([Sentry](https://chatwoot-p3.sentry.io/issues/6075125384))

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
Shivam Mishra
2025-01-16 15:49:48 +05:30
committed by GitHub
parent 79997fd86f
commit 1ccfb4e3db
5 changed files with 13 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ const lastNonActivityMessageContent = computed(() => {
props.conversation; props.conversation;
const { email: { subject } = {} } = customAttributes; const { email: { subject } = {} } = customAttributes;
return getPlainText( return getPlainText(
subject || lastNonActivityMessage.content || t('CHAT_LIST.NO_CONTENT') subject || lastNonActivityMessage?.content || t('CHAT_LIST.NO_CONTENT')
); );
}); });

View File

@@ -29,7 +29,7 @@ const lastNonActivityMessageContent = computed(() => {
props.conversation; props.conversation;
const { email: { subject } = {} } = customAttributes; const { email: { subject } = {} } = customAttributes;
return getPlainText( return getPlainText(
subject || lastNonActivityMessage.content || t('CHAT_LIST.NO_CONTENT') subject || lastNonActivityMessage?.content || t('CHAT_LIST.NO_CONTENT')
); );
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, useTemplateRef, ref } from 'vue'; import { computed, onMounted, useTemplateRef, ref } from 'vue';
import Icon from 'next/icon/Icon.vue'; import Icon from 'next/icon/Icon.vue';
import { timeStampAppendedURL } from 'dashboard/helper/URLHelper'; import { timeStampAppendedURL } from 'dashboard/helper/URLHelper';
@@ -29,6 +29,13 @@ const onLoadedMetadata = () => {
duration.value = audioPlayer.value?.duration; duration.value = audioPlayer.value?.duration;
}; };
// There maybe a chance that the audioPlayer ref is not available
// When the onLoadMetadata is called, so we need to set the duration
// value when the component is mounted
onMounted(() => {
duration.value = audioPlayer.value?.duration;
});
const formatTime = time => { const formatTime = time => {
const minutes = Math.floor(time / 60); const minutes = Math.floor(time / 60);
const seconds = Math.floor(time % 60); const seconds = Math.floor(time % 60);

View File

@@ -1,6 +1,6 @@
import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents'; import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents';
export function useChatListKeyboardEvents({ listRef }) { export function useChatListKeyboardEvents(listRef) {
const getKeyboardListenerParams = () => { const getKeyboardListenerParams = () => {
const allConversations = listRef.value.querySelectorAll( const allConversations = listRef.value.querySelectorAll(
'div.conversations-list div.conversation' 'div.conversations-list div.conversation'
@@ -19,6 +19,7 @@ export function useChatListKeyboardEvents({ listRef }) {
lastConversationIndex, lastConversationIndex,
}; };
}; };
const handleConversationNavigation = direction => { const handleConversationNavigation = direction => {
const { allConversations, activeConversationIndex, lastConversationIndex } = const { allConversations, activeConversationIndex, lastConversationIndex } =
getKeyboardListenerParams(); getKeyboardListenerParams();

View File

@@ -100,7 +100,7 @@ const actions = {
}, },
fetchAllAttachments: async ({ commit }, conversationId) => { fetchAllAttachments: async ({ commit }, conversationId) => {
let attachments = null; let attachments = [];
try { try {
const { data } = await ConversationApi.getAllAttachments(conversationId); const { data } = await ConversationApi.getAllAttachments(conversationId);