minor fixes for deletion compatibility
This commit is contained in:
parent
b821c89e20
commit
1a7828b281
@ -121,7 +121,7 @@ CREATE TABLE app_room (
|
|||||||
room_id INT AUTO_INCREMENT,
|
room_id INT AUTO_INCREMENT,
|
||||||
room_name VARCHAR(255) NOT NULL,
|
room_name VARCHAR(255) NOT NULL,
|
||||||
owner_id INT NOT NULL,
|
owner_id INT NOT NULL,
|
||||||
message_id INT NOT NULL,
|
message_id INT,
|
||||||
room_type INT NOT NULL DEFAULT 0,
|
room_type INT NOT NULL DEFAULT 0,
|
||||||
lastUpdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
|
lastUpdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
|
||||||
PRIMARY KEY (room_id),
|
PRIMARY KEY (room_id),
|
||||||
|
@ -35,7 +35,6 @@ export async function getMailbox(mailboxId: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function updateMailbox(mailboxId: number, uidnext: number) {
|
export function updateMailbox(mailboxId: number, uidnext: number) {
|
||||||
console.log("updateMailbox", mailboxId, uidnext);
|
|
||||||
const query = `UPDATE mailbox SET uidnext = ? WHERE mailbox_id = ?`;
|
const query = `UPDATE mailbox SET uidnext = ? WHERE mailbox_id = ?`;
|
||||||
const values = [uidnext, mailboxId];
|
const values = [uidnext, mailboxId];
|
||||||
execQuery(query, values);
|
execQuery(query, values);
|
||||||
|
@ -137,7 +137,7 @@ export default class Mailbox {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.err("Failed to sync message " + error);
|
logger.err("Failed to sync message " + error);
|
||||||
}
|
}
|
||||||
logger.log(`Saved messages ${i + STEP > nbMessageToSync ? nbMessageToSync : i + STEP}/${nbMessageToSync}`);
|
logger.log(`Saved messages in uids ${i + STEP > nbMessageToSync ? nbMessageToSync : i + STEP}/${nbMessageToSync}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if has receive new msg during last sync then start a new sync
|
// if has receive new msg during last sync then start a new sync
|
||||||
|
@ -35,7 +35,7 @@ if (shouldReset) {
|
|||||||
if (table.table_name == "mailbox") return;
|
if (table.table_name == "mailbox") return;
|
||||||
console.log(table.table_name);
|
console.log(table.table_name);
|
||||||
execQuery("DELETE FROM " + table.table_name, []);
|
execQuery("DELETE FROM " + table.table_name, []);
|
||||||
// execQuery("DROP TABLE " + table.table_name);
|
// execQuery("DROP TABLE " + table.table_name, []);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,12 @@ const store = createStore<State>({
|
|||||||
const msgs = msgOnRoomId(state, payload.roomId);
|
const msgs = msgOnRoomId(state, payload.roomId);
|
||||||
const msgIndex = msgs?.messages.findIndex((msg) => msg.id == payload.messageId) ?? -1;
|
const msgIndex = msgs?.messages.findIndex((msg) => msg.id == payload.messageId) ?? -1;
|
||||||
if (msgs && msgIndex != -1) {
|
if (msgs && msgIndex != -1) {
|
||||||
|
if (!isSeenFc(msgs.messages[msgIndex].flags)) {
|
||||||
|
const room = roomOnId(state, payload.roomId);
|
||||||
|
if (room) {
|
||||||
|
room.notSeen = room.notSeen - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
msgs.messages.splice(msgIndex, 1);
|
msgs.messages.splice(msgIndex, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -51,6 +51,7 @@ function openMessageView(messageId) {
|
|||||||
|
|
||||||
const shouldBeCompact = (index) => {
|
const shouldBeCompact = (index) => {
|
||||||
// show last three messages
|
// show last three messages
|
||||||
|
// todo fix not changing three displayed when deleting
|
||||||
if (messages.value?.length - 4 < index) return false;
|
if (messages.value?.length - 4 < index) return false;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user