feat: add attachments section to conversation sidebar (#14371)

This commit is contained in:
Sivin Varghese
2026-05-06 15:13:51 +05:30
committed by GitHub
parent 00ba468486
commit 8f532f45ff
9 changed files with 484 additions and 1 deletions
@@ -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;
@@ -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 };