mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-12-17 15:18:16 +08:00
fix(sync): Issue with CONDSTORE args not passed to fetch
This commit is contained in:
parent
82f505b659
commit
ece519553f
3 changed files with 9 additions and 9 deletions
|
|
@ -124,10 +124,10 @@ class IMAPBox {
|
||||||
* @return {Promise} that resolves to a map of uid -> attributes for every
|
* @return {Promise} that resolves to a map of uid -> attributes for every
|
||||||
* message in the range
|
* message in the range
|
||||||
*/
|
*/
|
||||||
fetchUIDAttributes(range) {
|
fetchUIDAttributes(range, fetchOptions = {}) {
|
||||||
return this._conn.createConnectionPromise((resolve, reject) => {
|
return this._conn.createConnectionPromise((resolve, reject) => {
|
||||||
const attributesByUID = {};
|
const attributesByUID = {};
|
||||||
const f = this._conn._imap.fetch(range, {});
|
const f = this._conn._imap.fetch(range, fetchOptions);
|
||||||
f.on('message', (msg) => {
|
f.on('message', (msg) => {
|
||||||
msg.on('attributes', (attrs) => {
|
msg.on('attributes', (attrs) => {
|
||||||
attributesByUID[attrs.uid] = attrs;
|
attributesByUID[attrs.uid] = attrs;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class FetchMessagesInFolder {
|
||||||
this._db = null
|
this._db = null
|
||||||
this._category = category;
|
this._category = category;
|
||||||
this._options = options;
|
this._options = options;
|
||||||
this._logger = logger;
|
this._logger = logger.child({category_name: this._category.name});
|
||||||
if (!this._logger) {
|
if (!this._logger) {
|
||||||
throw new Error("FetchMessagesInFolder requires a logger")
|
throw new Error("FetchMessagesInFolder requires a logger")
|
||||||
}
|
}
|
||||||
|
|
@ -124,14 +124,14 @@ class FetchMessagesInFolder {
|
||||||
.filter(msg => !remoteUIDAttributes[msg.folderImapUID])
|
.filter(msg => !remoteUIDAttributes[msg.folderImapUID])
|
||||||
.map(msg => msg.folderImapUID)
|
.map(msg => msg.folderImapUID)
|
||||||
|
|
||||||
this._logger.info({
|
|
||||||
removed_messages: removedUIDs.length,
|
|
||||||
}, `FetchMessagesInFolder: found messages no longer in the folder`)
|
|
||||||
|
|
||||||
if (removedUIDs.length === 0) {
|
if (removedUIDs.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._logger.info({
|
||||||
|
removed_messages: removedUIDs.length,
|
||||||
|
}, `FetchMessagesInFolder: found messages no longer in the folder`)
|
||||||
|
|
||||||
await this._db.sequelize.transaction((transaction) =>
|
await this._db.sequelize.transaction((transaction) =>
|
||||||
Message.update({
|
Message.update({
|
||||||
folderImapUID: null,
|
folderImapUID: null,
|
||||||
|
|
@ -248,7 +248,7 @@ class FetchMessagesInFolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _openMailboxAndEnsureValidity() {
|
async _openMailboxAndEnsureValidity() {
|
||||||
const box = this._imap.openBox(this._category.name);
|
const box = await this._imap.openBox(this._category.name);
|
||||||
|
|
||||||
if (box.persistentUIDs === false) {
|
if (box.persistentUIDs === false) {
|
||||||
throw new Error("Mailbox does not support persistentUIDs.");
|
throw new Error("Mailbox does not support persistentUIDs.");
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ class SyncWorker {
|
||||||
|
|
||||||
const target = this._lastSyncTime + (moreToSync ? 1 : intervals.active);
|
const target = this._lastSyncTime + (moreToSync ? 1 : intervals.active);
|
||||||
|
|
||||||
this._logger.info(`SyncWorker: Scheduling next sync iteration for ${target - Date.now()}ms}`)
|
this._logger.info(`SyncWorker: Scheduling next sync iteration for ${target - Date.now()}ms`)
|
||||||
|
|
||||||
this._syncTimer = setTimeout(() => {
|
this._syncTimer = setTimeout(() => {
|
||||||
this.syncNow({reason: 'Scheduled'});
|
this.syncNow({reason: 'Scheduled'});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue