Compare commits

..

39 Commits

Author SHA1 Message Date
grimhilt
fd253197cc show addresses in front 2023-04-03 20:37:07 +02:00
grimhilt
6b4264fccc show description in room header 2023-04-03 20:11:07 +02:00
grimhilt
4e48c5d813 start message to bottom 2023-04-02 17:39:04 +02:00
grimhilt
4bff5be6c1 use strict front 2023-04-02 16:52:19 +02:00
grimhilt
e3d8d3cf9b switch front to typescript 2023-04-02 16:44:54 +02:00
grimhilt
7f535f2e95 fix some errors on front 2023-04-02 13:36:59 +02:00
grimhilt
948ec3c7b4 improve logger 2023-04-02 12:59:11 +02:00
grimhilt
3042ed972b run server as typescript 2023-04-02 12:35:55 +02:00
grimhilt
11ab6a6a21 tests in typescript 2023-04-01 22:36:51 +02:00
grimhilt
90dd16ee0d started to convert to typescript 2023-04-01 16:32:29 +02:00
grimhilt
aced3b8914 add logic and more test to saveMessage 2023-04-01 15:07:49 +02:00
grimhilt
68e1dfe7d8 implement save of thread and members 2023-03-31 16:07:02 +02:00
grimhilt
a82ff9b85b improve tests saveMessage 2023-03-30 09:16:10 +02:00
grimhilt
8306543ddd improve saveMessage (switch to class) and started to test 2023-03-29 21:00:43 +02:00
grimhilt
6507d466ad logic pseudo code 2023-03-29 17:43:46 +02:00
grimhilt
44125fc55d get members 2023-03-29 16:48:28 +02:00
grimhilt
14dd6b36f8 fix duplicate content header 2023-03-29 16:34:30 +02:00
grimhilt
91898e25a5 improve syncing and storing 2023-03-29 16:23:24 +02:00
grimhilt
185f051a63 change logger 2023-03-28 16:57:44 +02:00
grimhilt
838550b6cc display mail in iframe, add design for thread and unseen 2023-03-27 01:04:43 +02:00
grimhilt
5447557f91 apply difference between mailbox and account 2023-03-26 14:55:13 +02:00
grimhilt
62dd43c3d5 link imap sync to server and show email on front 2023-03-26 14:20:16 +02:00
grimhilt
0ea7f5865b advancements in tests and storing messages 2023-03-25 16:47:23 +01:00
grimhilt
4d4ef54bcb load message in front 2023-03-25 13:06:59 +01:00
grimhilt
926dc60920 fix modal background opacity 2023-03-23 23:59:49 +01:00
grimhilt
d6f06f3ca6 start to load messages from rooms 2023-03-20 21:28:13 +01:00
grimhilt
9b3ddd291e basic routing for roomview 2023-03-20 15:00:15 +01:00
grimhilt
d7029854b4 fetch rooms 2023-03-20 14:43:07 +01:00
grimhilt
095efb5440 fetching mailboxes from api 2023-03-17 13:31:27 +01:00
grimhilt
14e64c1fc3 save message working without reply 2023-03-16 16:14:25 +01:00
grimhilt
95f39cf53a save message sync 2023-03-15 14:48:15 +01:00
grimhilt
f9fbab3a21 advancement on logic of app 2023-03-13 19:12:57 +01:00
grimhilt
aa9a69e17f add queries for app functionnalities 2023-03-13 00:54:44 +01:00
grimhilt
3286a2e52b started some app structure 2023-03-13 00:13:17 +01:00
grimhilt
9046ccf137 update database structure 2023-03-11 14:52:08 +01:00
grimhilt
29bf4bbdbd gloablly save messages 2023-03-10 17:07:05 +01:00
grimhilt
df69a7dbd9 solution clean not working 2023-03-10 16:18:04 +01:00
grimhilt
427ffba725 save 2023-03-10 16:08:50 +01:00
grimhilt
d3893c682e remove password 2023-03-01 16:57:11 +01:00
7 changed files with 69 additions and 55 deletions

View File

@ -101,9 +101,9 @@ export async function getMessages(roomId) {
export async function getMembers(roomId) {
const query = `
SELECT
address.address_id,
address.address_name,
address.email
address.address_id AS id,
address.address_name AS name,
address.email AS email
FROM app_room_member
INNER JOIN address ON address.address_id = app_room_member.member_id
WHERE app_room_member.room_id = ?

View File

@ -1,5 +1,5 @@
export function removeDuplicates(array: []) {
let unique = [];
const unique = [];
for (let i = 0; i < array.length; i++) {
if (!unique.includes(array[i])) {
unique.push(array[i]);

View File

@ -30,5 +30,7 @@ export interface Account {
}
export interface Address {
todo: boolean;
id: number;
name: string | null;
email: string;
}

View File

@ -1,5 +1,6 @@
import API from "@/services/imapAPI";
import { decodeEmojis } from "@/utils/string";
import { AxiosError, AxiosResponse } from "axios";
import { createStore, Store } from "vuex";
import { Room, Account, Address, RoomType, Message } from "./models/model";
@ -103,6 +104,12 @@ const store = createStore<State>({
const room = state.rooms.find((room) => room.id == roomId);
return room;
},
address:
(state) =>
(addressId: number): Address | undefined => {
const address = state.addresses.find((address) => address.id == addressId);
return address;
},
messages:
(state) =>
(roomId: number): Message[] => {
@ -117,21 +124,21 @@ const store = createStore<State>({
actions: {
fetchAccounts: async (context) => {
API.getAccounts()
.then((res) => {
.then((res: AxiosResponse) => {
context.commit("addAccounts", res.data);
})
.catch((err) => {
.catch((err: AxiosError) => {
console.log(err);
});
},
fetchRooms: async (context, data) => {
if (data.account?.fetched == false) {
API.getRooms(data.accountId)
.then((res) => {
.then((res: AxiosResponse) => {
data.account.fetched = true;
context.commit("addRooms", { rooms: res.data });
})
.catch((err) => {
.catch((err: AxiosError) => {
console.log(err);
});
}
@ -140,20 +147,20 @@ const store = createStore<State>({
if (!data.room || data.room?.fetched == false) {
store.dispatch("fetchRoomMembers", { roomId: data.roomId });
API.getMessages(data.roomId)
.then((res) => {
.then((res: AxiosResponse) => {
context.commit("addMessages", { messages: res.data, roomId: data.roomId });
})
.catch((err) => {
.catch((err: AxiosError) => {
console.log(err);
});
}
},
fetchRoomMembers: async (context, data) => {
API.getMembers(data.roomId)
.then((res) => {
.then((res: AxiosResponse) => {
context.commit("addAddress", { addresses: res.data, roomId: data.roomId });
})
.catch((err) => {
.catch((err: AxiosError) => {
console.log(err);
});
},

9
front/src/utils/array.ts Normal file
View File

@ -0,0 +1,9 @@
export function removeDuplicates(array: []) {
const unique: [] = [];
for (let i = 0; i < array.length; i++) {
if (!unique.includes(array[i])) {
unique.push(array[i]);
}
}
return unique;
}

View File

@ -1,7 +1,9 @@
<script setup>
import { defineProps, onMounted, ref } from "vue";
import { decodeEmojis } from "../../utils/string";
import { removeDuplicates } from "../../utils/array";
import DOMPurify from "dompurify";
import store from "@/store/store";
const props = defineProps({ data: Object });
const date = new Date(props.data.date);
@ -30,6 +32,17 @@ onMounted(() => {
`);
doc.close();
});
const displayAddresses = (addressesId) => {
// todo store members in rooms ?
addressesId = removeDuplicates(addressesId);
let res = "";
addressesId.forEach((addressId) => {
const address = store.getters.address(addressId);
if (address) res += address.email;
});
return res;
};
</script>
<!-- to if to is more than me
cc -->
@ -39,7 +52,9 @@ onMounted(() => {
<template>
<div class="message">
<div id="context">
<div class="left" id="profile">{{ props.data.fromA }}</div>
<div class="left" id="profile">
{{ displayAddresses(props.data.fromA?.split(",")) }} - {{ props.data.fromA }}
</div>
<div class="middle">{{ decodeEmojis(props.data.subject) }}</div>
<div class="right" id="date">
{{

View File

@ -1,44 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"allowJs": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"jest"
],
"paths": {
"@/*": [
"src/*",
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"allowJs": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"types": ["webpack-env", "jest"],
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
"exclude": ["node_modules"]
}