mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-05 04:04:38 +08:00
Strip the '[Gmail]/' prefix from folder names.
Summary: T7253 has two related parts: 1. Stripping the '[Gmail]/' prefix from any canonical Gmail folders 2. Handling nested IMAP folders. This diff fixes 1. Changes for 2. are forthcoming. Test Plan: Tested manually. Checked that the part was stripped from the N1 folder list. Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3475
This commit is contained in:
parent
d650be5429
commit
15cfe2cec0
3 changed files with 15 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
const {DatabaseTypes: {JSONType}} = require('isomorphic-core');
|
||||
const {formatImapPath} = require('../shared/imap-paths-utils');
|
||||
|
||||
module.exports = (sequelize, Sequelize) => {
|
||||
return sequelize.define('folder', {
|
||||
|
@ -32,7 +33,7 @@ module.exports = (sequelize, Sequelize) => {
|
|||
account_id: this.accountId,
|
||||
object: 'folder',
|
||||
name: this.role,
|
||||
display_name: this.name,
|
||||
display_name: formatImapPath(this.name),
|
||||
};
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const {formatImapPath} = require('../shared/imap-paths-utils');
|
||||
|
||||
module.exports = (sequelize, Sequelize) => {
|
||||
return sequelize.define('label', {
|
||||
id: { type: Sequelize.STRING(65), primaryKey: true },
|
||||
|
@ -53,7 +55,7 @@ module.exports = (sequelize, Sequelize) => {
|
|||
account_id: this.accountId,
|
||||
object: 'label',
|
||||
name: this.role,
|
||||
display_name: this.name,
|
||||
display_name: formatImapPath(this.name),
|
||||
};
|
||||
},
|
||||
},
|
||||
|
|
10
packages/local-sync/src/shared/imap-paths-utils.js
Normal file
10
packages/local-sync/src/shared/imap-paths-utils.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
function formatImapPath(pathStr) {
|
||||
if (!pathStr) {
|
||||
throw new Error("Can not format an empty path!");
|
||||
}
|
||||
|
||||
const s = pathStr.replace(/^\[Gmail\]\//, '');
|
||||
return s;
|
||||
}
|
||||
|
||||
module.exports = {formatImapPath}
|
Loading…
Add table
Reference in a new issue