mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
[local-sync] Cleanup, use Provider constants
This commit is contained in:
parent
941c564443
commit
bda6a78ae1
|
@ -140,10 +140,6 @@ module.exports = (sequelize, Sequelize) => {
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
|
||||||
supportsLabels() {
|
|
||||||
return this.provider === 'gmail'
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const Joi = require('joi');
|
const Joi = require('joi');
|
||||||
|
const {Provider} = require('isomorphic-core')
|
||||||
const Serialization = require('../serialization');
|
const Serialization = require('../serialization');
|
||||||
const {createAndReplyWithSyncbackRequest} = require('../route-helpers');
|
const {createAndReplyWithSyncbackRequest} = require('../route-helpers');
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ module.exports = (server) => {
|
||||||
const payload = request.payload
|
const payload = request.payload
|
||||||
if (payload.label_ids || payload.labels) {
|
if (payload.label_ids || payload.labels) {
|
||||||
const account = request.auth.credentials;
|
const account = request.auth.credentials;
|
||||||
if (account.supportsLabels()) {
|
if (account.provider === Provider.Gmail) {
|
||||||
createAndReplyWithSyncbackRequest(request, reply, {
|
createAndReplyWithSyncbackRequest(request, reply, {
|
||||||
type: "SetMessageLabels",
|
type: "SetMessageLabels",
|
||||||
props: {
|
props: {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const {SendmailClient, Errors: {APIError}} = require('isomorphic-core')
|
const {SendmailClient, Provider, Errors: {APIError}} = require('isomorphic-core')
|
||||||
const IMAPHelpers = require('../imap-helpers')
|
const IMAPHelpers = require('../imap-helpers')
|
||||||
const SyncbackTask = require('./syncback-task')
|
const SyncbackTask = require('./syncback-task')
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class EnsureMessageInSentFolderIMAP extends SyncbackTask {
|
||||||
// Each participant gets a message, but all of those messages have the
|
// Each participant gets a message, but all of those messages have the
|
||||||
// same Message-ID header in them. This allows us to find all of the
|
// same Message-ID header in them. This allows us to find all of the
|
||||||
// sent messages and clean them up
|
// sent messages and clean them up
|
||||||
if (sentPerRecipient && provider === 'gmail') {
|
if (sentPerRecipient && provider === Provider.Gmail) {
|
||||||
try {
|
try {
|
||||||
await IMAPHelpers.deleteGmailSentMessages({db, imap, provider, headerMessageId})
|
await IMAPHelpers.deleteGmailSentMessages({db, imap, provider, headerMessageId})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in a new issue