mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-28 14:55:48 +00:00
Almost all JSON properties to JavaScript camelCase
This commit is contained in:
@@ -22,7 +22,7 @@ export class AttachmentModel extends AbstractModel {
|
||||
this.fileNameExt = '';
|
||||
this.fileType = FileType.Unknown;
|
||||
this.isThumbnail = false;
|
||||
this.cid = '';
|
||||
this.cId = '';
|
||||
this.contentLocation = '';
|
||||
this.download = '';
|
||||
this.folder = '';
|
||||
@@ -61,7 +61,7 @@ export class AttachmentModel extends AbstractModel {
|
||||
}
|
||||
|
||||
contentId() {
|
||||
return this.cid.replace(/^<+|>+$/g, '');
|
||||
return this.cId.replace(/^<+|>+$/g, '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,11 +21,11 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} cid
|
||||
* @param {string} cId
|
||||
* @returns {*}
|
||||
*/
|
||||
findByCid(cid) {
|
||||
cid = cid.replace(/^<+|>+$/g, '');
|
||||
return this.find(item => cid === item.contentId());
|
||||
findByCid(cId) {
|
||||
cId = cId.replace(/^<+|>+$/g, '');
|
||||
return this.find(item => cId === item.contentId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ export class ComposeAttachmentModel extends AbstractModel {
|
||||
* @param {?number=} size = null
|
||||
* @param {boolean=} isInline = false
|
||||
* @param {boolean=} isLinked = false
|
||||
* @param {string=} CID = ''
|
||||
* @param {string=} cId = ''
|
||||
* @param {string=} contentLocation = ''
|
||||
*/
|
||||
constructor(id, fileName, size = null, isInline = false, isLinked = false, CID = '', contentLocation = '') {
|
||||
constructor(id, fileName, size = null, isInline = false, isLinked = false, cId = '', contentLocation = '') {
|
||||
super();
|
||||
|
||||
this.id = id;
|
||||
this.isInline = !!isInline;
|
||||
this.isLinked = !!isLinked;
|
||||
this.CID = CID;
|
||||
this.cId = cId;
|
||||
this.contentLocation = contentLocation;
|
||||
this.fromMessage = false;
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ export class ContactModel extends AbstractModel {
|
||||
// jCard.set('rev', '2022-05-21T10:59:52Z')
|
||||
|
||||
return {
|
||||
Uid: this.id,
|
||||
uid: this.id,
|
||||
jCard: JSON.stringify(jCard)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||
);
|
||||
|
||||
const result = super.reviveFromJson(object, oFolder => {
|
||||
let oCacheFolder = getFolderFromCacheList(oFolder.FullName);
|
||||
let oCacheFolder = getFolderFromCacheList(oFolder.fullName);
|
||||
if (oCacheFolder) {
|
||||
// oCacheFolder.revivePropertiesFromJson(oFolder);
|
||||
if (oFolder.Hash) {
|
||||
oCacheFolder.hash = oFolder.Hash;
|
||||
if (oFolder.hash) {
|
||||
oCacheFolder.hash = oFolder.hash;
|
||||
}
|
||||
if (null != oFolder.totalEmails) {
|
||||
oCacheFolder.totalEmails(oFolder.totalEmails);
|
||||
@@ -167,32 +167,32 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||
break;
|
||||
}
|
||||
// Flags
|
||||
if (oFolder.Flags.includes('\\sentmail')) {
|
||||
if (oFolder.flags.includes('\\sentmail')) {
|
||||
role = 'sent';
|
||||
}
|
||||
if (oFolder.Flags.includes('\\spam')) {
|
||||
if (oFolder.flags.includes('\\spam')) {
|
||||
role = 'junk';
|
||||
}
|
||||
if (oFolder.Flags.includes('\\bin')) {
|
||||
if (oFolder.flags.includes('\\bin')) {
|
||||
role = 'trash';
|
||||
}
|
||||
if (oFolder.Flags.includes('\\important')) {
|
||||
if (oFolder.flags.includes('\\important')) {
|
||||
role = 'important';
|
||||
}
|
||||
if (oFolder.Flags.includes('\\starred')) {
|
||||
if (oFolder.flags.includes('\\starred')) {
|
||||
role = 'flagged';
|
||||
}
|
||||
if (oFolder.Flags.includes('\\all') || oFolder.Flags.includes('\\allmail')) {
|
||||
if (oFolder.flags.includes('\\all') || oFolder.flags.includes('\\allmail')) {
|
||||
role = 'all';
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (role) {
|
||||
role = role[0].toUpperCase() + role.slice(1);
|
||||
SystemFolders[role] || (SystemFolders[role] = oFolder.FullName);
|
||||
SystemFolders[role] || (SystemFolders[role] = oFolder.fullName);
|
||||
}
|
||||
|
||||
oCacheFolder.type(FolderType[getKeyByValue(SystemFolders, oFolder.FullName)] || 0);
|
||||
oCacheFolder.type(FolderType[getKeyByValue(SystemFolders, oFolder.fullName)] || 0);
|
||||
|
||||
oCacheFolder.collapsed(!expandedFolders
|
||||
|| !isArray(expandedFolders)
|
||||
@@ -223,12 +223,12 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||
if (!pfolder) {
|
||||
pfolder = FolderModel.reviveFromJson({
|
||||
'@Object': 'Object/Folder',
|
||||
Name: name,
|
||||
FullName: parentName,
|
||||
Delimiter: delimiter,
|
||||
Exists: false,
|
||||
name: name,
|
||||
fullName: parentName,
|
||||
delimiter: delimiter,
|
||||
exists: false,
|
||||
isSubscribed: false,
|
||||
Flags: ['\\nonexistent']
|
||||
flags: ['\\nonexistent']
|
||||
});
|
||||
setFolder(pfolder);
|
||||
result.splice(i, 0, pfolder);
|
||||
|
||||
@@ -43,7 +43,7 @@ const
|
||||
// MessageFlagsCache.setFor(message.folder, message.uid, flags());
|
||||
}
|
||||
}, {
|
||||
Folder: message.folder,
|
||||
folder: message.folder,
|
||||
Uids: message.uid,
|
||||
Keyword: keyword,
|
||||
SetAction: isSet ? 0 : 1
|
||||
@@ -188,12 +188,9 @@ export class MessageModel extends AbstractModel {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
revivePropertiesFromJson(json) {
|
||||
if ('Priority' in json && ![MessagePriority.High, MessagePriority.Low].includes(json.Priority)) {
|
||||
json.Priority = MessagePriority.Normal;
|
||||
}
|
||||
if (super.revivePropertiesFromJson(json)) {
|
||||
// this.foundCIDs = isArray(json.FoundCIDs) ? json.FoundCIDs : [];
|
||||
// this.attachments(AttachmentCollectionModel.reviveFromJson(json.Attachments, this.foundCIDs));
|
||||
// this.attachments(AttachmentCollectionModel.reviveFromJson(json.attachments, this.foundCIDs));
|
||||
|
||||
this.computeSenderEmail();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export class MessageCollectionModel extends AbstractCollectionModel
|
||||
constructor() {
|
||||
super();
|
||||
this.Filtered
|
||||
this.Folder
|
||||
this.folder
|
||||
this.folderHash
|
||||
this.folderInfo
|
||||
this.totalEmails
|
||||
|
||||
Reference in New Issue
Block a user