add thread in api and front
This commit is contained in:
@@ -30,24 +30,24 @@ export async function getAccounts() {
|
||||
export async function getRooms(mailboxId) {
|
||||
const query = `
|
||||
SELECT
|
||||
app_room.room_id AS id,
|
||||
app_room.room_name AS roomName,
|
||||
room.room_id AS id,
|
||||
room.room_name AS roomName,
|
||||
address.email AS user,
|
||||
app_room.owner_id AS userId,
|
||||
app_room.notSeen,
|
||||
app_room.room_type AS roomType,
|
||||
mailbox_message.mailbox_id AS mailboxId
|
||||
FROM app_room
|
||||
INNER JOIN message
|
||||
INNER JOIN mailbox_message
|
||||
INNER JOIN address
|
||||
room.owner_id AS userId,
|
||||
room.notSeen,
|
||||
room.room_type AS roomType,
|
||||
mailbox_message.mailbox_id AS mailboxId,
|
||||
app_thread.parent_id
|
||||
FROM app_room room
|
||||
INNER JOIN message ON message.message_id = room.message_id
|
||||
INNER JOIN mailbox_message ON mailbox_message.message_id = message.message_id
|
||||
INNER JOIN address ON address.address_id = room.owner_id
|
||||
LEFT JOIN app_thread ON room.room_id = app_thread.room_id
|
||||
|
||||
WHERE
|
||||
message.message_id = app_room.message_id AND
|
||||
mailbox_message.mailbox_id = ? AND
|
||||
mailbox_message.message_id = message.message_id AND
|
||||
address.address_id = app_room.owner_id
|
||||
ORDER BY app_room.lastUpdate DESC
|
||||
`;
|
||||
mailbox_message.mailbox_id = ?
|
||||
ORDER BY room.lastUpdate DESC
|
||||
`;
|
||||
const values = [mailboxId];
|
||||
return await execQueryAsync(query, values);
|
||||
}
|
||||
|
||||
@@ -145,6 +145,8 @@ export default class RegisterMessageInApp {
|
||||
await this.incrementNotSeen(roomId);
|
||||
if (isThread) {
|
||||
await getThreadInfoOnId(roomId).then(async (res) => {
|
||||
let root_id = res[0].root_id;
|
||||
if (root_id == undefined) root_id = res[0].room_id;
|
||||
await this.incrementNotSeen(res[0].root_id);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user