diff --git a/back/abl/Messages-abl.ts b/back/abl/Message-abl.ts similarity index 100% rename from back/abl/Messages-abl.ts rename to back/abl/Message-abl.ts diff --git a/back/db/api-db.ts b/back/db/api-db.ts index 430f552..8ac88b6 100644 --- a/back/db/api-db.ts +++ b/back/db/api-db.ts @@ -128,7 +128,7 @@ export async function getMessages(roomId: number) { return await execQueryAsync(query, values); } -export async function getMembers(roomId) { +export async function getMembers(roomId: number) { const query = ` SELECT address.address_id AS id, diff --git a/back/mails/message/storeMessage.ts b/back/mails/message/storeMessage.ts index 411905b..c8d5f76 100644 --- a/back/mails/message/storeMessage.ts +++ b/back/mails/message/storeMessage.ts @@ -120,7 +120,7 @@ async function saveFromParsedData(parsed: ParsedMail, messageId: number) { }); }); } else if (key == "attachments") { - // todo + // todo attachments } else if (["date", "messageId", "headers", "headerLines"].includes(key)) { // messageId and date are already saved // other field are not important and can be retrieved in source diff --git a/back/test/mail/saveMessage-test.ts b/back/test/mail/saveMessage-test.ts index f46b7c6..65b1e1b 100644 --- a/back/test/mail/saveMessage-test.ts +++ b/back/test/mail/saveMessage-test.ts @@ -146,6 +146,7 @@ describe("saveMessage", () => { await register.save(); + // the owner of the room will be the recipient (not us) expect(createOrRegisterOnExistence).toHaveBeenCalledWith(db.users[1].id, RoomType.DM); }); it("should create a GROUP when there is a new first message from us to multiple recipients", async () => { diff --git a/back/test/test-utils/db/test-saveMessage.ts b/back/test/test-utils/db/test-saveMessage.ts index 17675f1..72ef0af 100644 --- a/back/test/test-utils/db/test-saveMessage.ts +++ b/back/test/test-utils/db/test-saveMessage.ts @@ -29,7 +29,7 @@ export default class saveMessageDatabase { this.rooms = []; this.messages = []; this.room_message = []; - this.users = generateUsers(5); // todo + this.users = _users; this.roomId = 0; } diff --git a/front/src/components/modals/MessageViewModal.vue b/front/src/components/modals/MessageViewModal.vue index c8c85ef..1db010b 100644 --- a/front/src/components/modals/MessageViewModal.vue +++ b/front/src/components/modals/MessageViewModal.vue @@ -31,7 +31,7 @@ watch( .main { min-width: 700px; } -/* todo */ +/* todo define size automatically */ .content { width: 700px; height: 700px; diff --git a/front/src/store/store.ts b/front/src/store/store.ts index d19655f..1b4575a 100644 --- a/front/src/store/store.ts +++ b/front/src/store/store.ts @@ -14,7 +14,6 @@ interface RoomFromBack { userId: number; notSeen: number; parent_id?: number; - // todo thread } interface AccountFromBack { @@ -99,7 +98,7 @@ const store = createStore({ setActiveRoom(state, payload) { state.activeRoom = payload; // todo load room on load page - const room = state.rooms.find((room) => room.id == payload); + const room = roomOnId(state, payload); if (!room) return; let roomMessage = msgOnRoomId(state, payload); if (!roomMessage) { @@ -201,6 +200,12 @@ const store = createStore({ store.dispatch("fetchMessages", { roomId: roomId, obj: msgOnRoomId(state, roomId) }); return msgOnRoomId(state, roomId)?.messages ?? []; }, + accountOfRoom: + (state) => + (roomId: number): string | undefined => { + const room = roomOnId(state, roomId); + return state.accounts.find((account) => account.id == room?.mailboxId)?.email; + }, }, actions: { fetchAccounts: async (context) => {