Merge branch 'feat/whatsapp-call-meta-bridge' into feat/whatsapp-call-ui

# Conflicts:
#	app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue
This commit is contained in:
Tanmay Deep Sharma
2026-05-07 15:41:24 +07:00
98 changed files with 4524 additions and 468 deletions
@@ -30,6 +30,11 @@ export const getters = {
.filter(record => record.attribute_model === 'contact_attribute')
.map(camelcaseKeys);
},
getCompanyAttributes: _state => {
return _state.records
.filter(record => record.attribute_model === 'company_attribute')
.map(camelcaseKeys);
},
getAttributesByModel: _state => attributeModel => {
return _state.records.filter(
record => record.attribute_model === attributeModel
@@ -57,6 +57,8 @@ const getters = {
getSelectedChatAttachments: ({ selectedChatId, attachments }) => {
return attachments[selectedChatId] || [];
},
getSelectedChatAttachmentsLoaded: ({ selectedChatId, attachments }) =>
selectedChatId !== null && attachments[selectedChatId] !== undefined,
getChatListFilters: ({ conversationFilters }) => conversationFilters,
getLastEmailInSelectedChat: (stage, _getters) => {
const selectedChat = _getters.getSelectedChat;
@@ -35,6 +35,36 @@ describe('#getters', () => {
]);
});
it('getCompanyAttributes', () => {
const state = {
records: [
{
attribute_display_name: 'Industry',
attribute_display_type: 0,
attribute_description: 'Company industry',
attribute_key: 'industry',
attribute_model: 'company_attribute',
},
{
attribute_display_name: 'Language',
attribute_display_type: 1,
attribute_description: 'Conversation language',
attribute_key: 'language',
attribute_model: 'conversation_attribute',
},
],
};
expect(getters.getCompanyAttributes(state)).toEqual([
{
attributeDisplayName: 'Industry',
attributeDisplayType: 0,
attributeDescription: 'Company industry',
attributeKey: 'industry',
attributeModel: 'company_attribute',
},
]);
});
it('getUIFlags', () => {
const state = {
uiFlags: {
@@ -328,6 +328,31 @@ describe('#getters', () => {
});
});
describe('#getSelectedChatAttachmentsLoaded', () => {
it('returns true when attachments have been fetched for the selected chat', () => {
const state = { selectedChatId: 1, attachments: { 1: [] } };
expect(getters.getSelectedChatAttachmentsLoaded(state)).toBe(true);
});
it('returns true when the fetched attachment list is non-empty', () => {
const state = {
selectedChatId: 1,
attachments: { 1: [{ id: 1, file_name: 'test' }] },
};
expect(getters.getSelectedChatAttachmentsLoaded(state)).toBe(true);
});
it('returns false when attachments have not been fetched yet', () => {
const state = { selectedChatId: 1, attachments: {} };
expect(getters.getSelectedChatAttachmentsLoaded(state)).toBe(false);
});
it('returns false when no chat is selected', () => {
const state = { selectedChatId: null, attachments: {} };
expect(getters.getSelectedChatAttachmentsLoaded(state)).toBe(false);
});
});
describe('#getContextMenuChatId', () => {
it('returns the context menu chat id', () => {
const state = { contextMenuChatId: 1 };