fix types highestmodseq

This commit is contained in:
grimhilt 2023-05-02 12:12:09 +02:00
parent 91a52a29ce
commit 29b4b7bfeb
4 changed files with 8 additions and 7 deletions

3
.gitignore vendored
View File

@ -31,4 +31,5 @@ log*
tmp
test.*
*.png
!*/schemas/*
!*/schemas/*
todo

View File

@ -1,4 +1,4 @@
import Imap, { ImapMessageAttributes, Box } from "imap";
import Imap, { Box } from "imap";
import { getMailbox, getMailboxModseq, updateMailbox, updateMailboxModseq } from "../../db/imap/imap-db";
import { Attrs, AttrsWithEnvelope } from "../../interfaces/mail/attrs.interface";
import logger from "../../system/Logger";
@ -35,6 +35,7 @@ export default class Mailbox {
this.box = (await getMailbox(this.id))[0];
const isReadOnly = false;
this.imap.openBox(this.boxName, isReadOnly, (err, box) => {
console.log(typeof(box.highestmodseq))
if (err) logger.err(err);
// sync messages and flags
@ -62,7 +63,7 @@ export default class Mailbox {
async updateModseq(newModseq: number) {
updateMailboxModseq(this.id, newModseq).then(() => {
this.box.highestmodseq = newModseq;
this.box.highestmodseq = newModseq.toString();
});
}
@ -76,7 +77,7 @@ export default class Mailbox {
// sync flags
const lastModseq = (await getMailboxModseq(this.id))[0]?.modseq ?? 0;
if (box.highestmodseq > lastModseq) {
if (parseInt(box.highestmodseq) > lastModseq) {
const fetchStream = this.imap.fetch("1:*", { bodies: "", modifiers: { changedsince: lastModseq } });
fetchStream.on("message", (message) => {
message.once("attributes", (attrs) => {
@ -93,7 +94,7 @@ export default class Mailbox {
} else {
logger.log("Flags already up to date")
}
this.updateModseq(box.highestmodseq);
this.updateModseq(parseInt(box.highestmodseq));
}
async syncMail(savedUid: number, currentUid: number) {

View File

@ -69,6 +69,7 @@ const setFlag = (flag: string, loadingState: Ref<boolean>) => {
class="option"
:loading="flaggedLoading"
:classes="hasFlag(props.msg?.flags, '\\Flagged') ? 'warn' : ''"
v-tooltip="hasFlag(props.msg?.flags, '\\Flagged') ? 'Unflag' : 'Flag'"
/>
<!--
<SvgLoader
@ -93,8 +94,6 @@ const setFlag = (flag: string, loadingState: Ref<boolean>) => {
<SvgLoader svg="reply-all-line" class="option" />
</div>
<div>reply</div>
<div>delete from all</div>
<div>delete from remote</div>
<div>transfer</div>
<div>see source</div>
<div>{{ props.msg?.flags }}</div>