fix types highestmodseq
This commit is contained in:
parent
91a52a29ce
commit
29b4b7bfeb
3
.gitignore
vendored
3
.gitignore
vendored
@ -31,4 +31,5 @@ log*
|
|||||||
tmp
|
tmp
|
||||||
test.*
|
test.*
|
||||||
*.png
|
*.png
|
||||||
!*/schemas/*
|
!*/schemas/*
|
||||||
|
todo
|
@ -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) {
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user