diff --git a/app/javascript/dashboard/store/modules/conversations/index.js b/app/javascript/dashboard/store/modules/conversations/index.js index 9a2fc4501..d873516fb 100644 --- a/app/javascript/dashboard/store/modules/conversations/index.js +++ b/app/javascript/dashboard/store/modules/conversations/index.js @@ -8,6 +8,21 @@ import { BUS_EVENTS } from '../../../../shared/constants/busEvents'; import { emitter } from 'shared/helpers/mitt'; import * as Sentry from '@sentry/vue'; +const makeCompactJson = obj => { + // get rid of irrelevant data + const { messages, additional_attributes, sla_events, ...remaining } = obj; + const strinRep = JSON.stringify(remaining); + + // replace active storage URLs with a placeholder + const activeStorageUrlRegex = + /https?:\/\/[^/]+\/rails\/active_storage[^\s]+/g; + const replacedStr = strinRep.replace( + activeStorageUrlRegex, + '[ACTIVE_STORAGE_URL]' + ); + return replacedStr; +}; + const state = { allConversations: [], attachments: {}, @@ -212,21 +227,6 @@ export const mutations = { const { allConversations } = _state; const index = allConversations.findIndex(c => c.id === conversation.id); - const makeCompactJson = obj => { - // get rid of messages - const { messages, ...remaining } = obj; - const strinRep = JSON.stringify(remaining); - - // replace active storage URLs with a placeholder - const activeStorageUrlRegex = - /https?:\/\/[^/]+\/rails\/active_storage[^\s]+/g; - const replacedStr = strinRep.replace( - activeStorageUrlRegex, - '[ACTIVE_STORAGE_URL]' - ); - return replacedStr; - }; - if (index > -1) { const selectedConversation = allConversations[index];