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

1
.gitignore vendored
View File

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

View File

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