Almost all JSON properties to JavaScript camelCase

This commit is contained in:
the-djmaze 2023-01-24 18:58:25 +01:00
parent 7a53cae32f
commit f080a302b1
50 changed files with 501 additions and 562 deletions

View file

@ -114,23 +114,23 @@ folderInformation = (folder, list) => {
Remote.request('FolderInformation', (iError, data) => {
if (!iError && data.Result) {
const result = data.Result,
folderFromCache = getFolderFromCacheList(result.Folder);
folderFromCache = getFolderFromCacheList(result.folder);
if (folderFromCache) {
const oldHash = folderFromCache.hash,
unreadCountChange = (folderFromCache.unreadEmails() !== result.unreadEmails);
// folderFromCache.revivePropertiesFromJson(result);
folderFromCache.expires = Date.now();
folderFromCache.uidNext = result.UidNext;
folderFromCache.hash = result.Hash;
folderFromCache.uidNext = result.uidNext;
folderFromCache.hash = result.hash;
folderFromCache.totalEmails(result.totalEmails);
folderFromCache.unreadEmails(result.unreadEmails);
unreadCountChange && MessageFlagsCache.clearFolder(folderFromCache.fullName);
if (result.MessagesFlags.length) {
result.MessagesFlags.forEach(message =>
MessageFlagsCache.setFor(folderFromCache.fullName, message.Uid.toString(), message.Flags)
if (result.messagesFlags.length) {
result.messagesFlags.forEach(message =>
MessageFlagsCache.setFor(folderFromCache.fullName, message.uid.toString(), message.flags)
);
MessagelistUserStore.reloadFlagsAndCachedMessage();
@ -138,7 +138,7 @@ folderInformation = (folder, list) => {
MessagelistUserStore.notifyNewMessages(folderFromCache.fullName, result.newMessages);
if (!oldHash || unreadCountChange || result.Hash !== oldHash) {
if (!oldHash || unreadCountChange || result.hash !== oldHash) {
if (folderFromCache.fullName === FolderUserStore.currentFolderFullName()) {
MessagelistUserStore.reload();
} else if (getFolderInboxName() === folderFromCache.fullName) {
@ -149,9 +149,9 @@ folderInformation = (folder, list) => {
}
}
}, {
Folder: folder,
FlagsUids: uids,
UidNext: folderFromCache?.uidNext || 0 // Used to check for new messages
folder: folder,
flagsUids: uids,
uidNext: folderFromCache?.uidNext || 0 // Used to check for new messages
});
} else if (SettingsUserStore.useThreads()) {
MessagelistUserStore.reloadFlagsAndCachedMessage();
@ -169,7 +169,7 @@ folderInformationMultiply = (boot = false) => {
if (!iError && arrayLength(oData.Result)) {
const utc = Date.now();
oData.Result.forEach(item => {
const folder = getFolderFromCacheList(item.Folder);
const folder = getFolderFromCacheList(item.folder);
if (folder) {
const oldHash = folder.hash,
@ -177,13 +177,13 @@ folderInformationMultiply = (boot = false) => {
// folder.revivePropertiesFromJson(item);
folder.expires = utc;
folder.hash = item.Hash;
folder.hash = item.hash;
folder.totalEmails(item.totalEmails);
folder.unreadEmails(item.unreadEmails);
unreadCountChange && MessageFlagsCache.clearFolder(folder.fullName);
if (!oldHash || item.Hash !== oldHash) {
if (!oldHash || item.hash !== oldHash) {
if (folder.fullName === FolderUserStore.currentFolderFullName()) {
MessagelistUserStore.reload();
}
@ -239,7 +239,7 @@ messagesDeleteHelper = (sFromFolderFullName, aUidForRemove) => {
Remote.abort('MessageList').request('MessageDelete',
moveOrDeleteResponseHelper,
{
Folder: sFromFolderFullName,
folder: sFromFolderFullName,
Uids: [...aUidForRemove].join(',')
}
);
@ -282,7 +282,7 @@ dropFilesInFolder = (sFolderFullName, files) => {
if ('message/rfc822' === file.type) {
++count;
let data = new FormData;
data.append('Folder', sFolderFullName);
data.append('folder', sFolderFullName);
data.append('AppendFile', file);
data.XToken = Settings.app('token');
fetch(serverRequest('Append'), {

View file

@ -98,9 +98,9 @@ export const
hasExternals: false
},
findAttachmentByCid = cid => oAttachments.findByCid(cid),
findLocationByCid = cid => {
const attachment = findAttachmentByCid(cid);
findAttachmentByCid = cId => oAttachments.findByCid(cId),
findLocationByCid = cId => {
const attachment = findAttachmentByCid(cId);
return attachment?.contentLocation ? attachment : 0;
},

View file

@ -266,10 +266,10 @@ populateMessageBody = (oMessage, popup) => {
if (
json &&
MessageModel.validJson(json) &&
oMessage.folder === json.Folder
oMessage.folder === json.folder
) {
const threads = oMessage.threads(),
isNew = !popup && oMessage.uid != json.Uid && threads.includes(json.Uid),
isNew = !popup && oMessage.uid != json.uid && threads.includes(json.uid),
messagesDom = MessageUserStore.bodiesDom();
if (isNew) {
oMessage = MessageModel.reviveFromJson(json);
@ -283,11 +283,11 @@ populateMessageBody = (oMessage, popup) => {
MessageUserStore.message(oMessage);
}
if (oMessage && oMessage.uid == json.Uid) {
if (oMessage && oMessage.uid == json.uid) {
popup || MessageUserStore.error('');
/*
if (bCached) {
delete json.Flags;
delete json.flags;
}
*/
isNew || oMessage.revivePropertiesFromJson(json);

View file

@ -86,7 +86,7 @@ export class AbstractModel {
}
forEachObjectEntry(json, (key, value) => {
if ('@' !== key[0]) try {
key = key[0].toLowerCase() + key.slice(1);
// key = key[0].toLowerCase() + key.slice(1);
switch (typeof this[key])
{
case 'function':

View file

@ -30,9 +30,9 @@ export function MimeToMessage(data, message)
struct.forEach(part => {
let cd = part.header('content-disposition'),
cid = part.header('content-id'),
cId = part.header('content-id'),
type = part.header('content-type');
if (cid || cd) {
if (cId || cd) {
// if (cd && 'attachment' === cd.value) {
let attachment = new AttachmentModel;
attachment.mimeType = type.value;
@ -49,8 +49,8 @@ export function MimeToMessage(data, message)
attachment.uid = '';
attachment.mimeIndex = part.id;
*/
attachment.cid = cid ? cid.value : '';
if (cid && html) {
attachment.cId = cId ? cId.value : '';
if (cId && html) {
let cid = 'cid:' + attachment.contentId(),
found = html.includes(cid);
attachment.isInline(found);
@ -64,9 +64,9 @@ export function MimeToMessage(data, message)
}
} else if ('multipart/signed' === type.value && 'application/pgp-signature' === type.params.protocol) {
signed = {
MicAlg: type.micalg,
BodyPart: part.parts[0],
SigPart: part.parts[1]
micAlg: type.micalg,
bodyPart: part.parts[0],
sigPart: part.parts[1]
};
}
});

View file

@ -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, '');
}
/**

View file

@ -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());
}
}

View file

@ -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;

View file

@ -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)
};
}

View file

@ -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);

View file

@ -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();
}

View file

@ -13,7 +13,7 @@ export class MessageCollectionModel extends AbstractCollectionModel
constructor() {
super();
this.Filtered
this.Folder
this.folder
this.folderHash
this.folderInfo
this.totalEmails

View file

@ -109,9 +109,9 @@ class RemoteUserFetch extends AbstractFetchRemote {
/*
folderMove(sPrevFolderFullName, sNewFolderFullName, bSubscribe) {
return this.post('FolderMove', FolderUserStore.foldersRenaming, {
Folder: sPrevFolderFullName,
NewFolder: sNewFolderFullName,
Subscribe: bSubscribe ? 1 : 0
folder: sPrevFolderFullName,
newFolder: sNewFolderFullName,
subscribe: bSubscribe ? 1 : 0
});
}
*/

View file

@ -62,9 +62,9 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
const nameToEdit = folder?.nameForEdit().trim();
if (nameToEdit && folder.name() !== nameToEdit) {
Remote.abort('Folders').post('FolderRename', FolderUserStore.foldersRenaming, {
Folder: folder.fullName,
NewFolderName: nameToEdit,
Subscribe: folder.isSubscribed() ? 1 : 0
folder: folder.fullName,
newFolderName: nameToEdit,
subscribe: folder.isSubscribed() ? 1 : 0
})
.then(data => {
folder.name(nameToEdit/*data.name*/);
@ -76,7 +76,7 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
// TODO: rename all subfolders with folder.delimiter to prevent reload?
} else {
removeFolderFromCacheList(folder.fullName);
folder.fullName = data.Result.FullName;
folder.fullName = data.Result.fullName;
setFolder(folder);
const parent = getFolderFromCacheList(folder.parentName);
sortFolders(parent ? parent.subFolders : FolderUserStore.folderList);
@ -126,7 +126,7 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
if (folderToRemove) {
Remote.abort('Folders').post('FolderDelete', FolderUserStore.foldersDeleting, {
Folder: folderToRemove.fullName
folder: folderToRemove.fullName
}).then(
() => {
// folderToRemove.flags.push('\\nonexistent');
@ -159,7 +159,7 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
let type = event.target.value;
// TODO: append '.default' ?
Remote.request('FolderSetMetadata', null, {
Folder: folder.fullName,
folder: folder.fullName,
Key: FolderMetadataKeys.KolabFolderType,
Value: type
});
@ -169,8 +169,8 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
toggleFolderSubscription(folder) {
let subscribe = !folder.isSubscribed();
Remote.request('FolderSubscribe', null, {
Folder: folder.fullName,
Subscribe: subscribe ? 1 : 0
folder: folder.fullName,
subscribe: subscribe ? 1 : 0
});
folder.isSubscribed(subscribe);
}
@ -178,8 +178,8 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
toggleFolderCheckable(folder) {
let checkable = !folder.checkable();
Remote.request('FolderCheckable', null, {
Folder: folder.fullName,
Checkable: checkable ? 1 : 0
folder: folder.fullName,
checkable: checkable ? 1 : 0
});
folder.checkable(checkable);
}

View file

@ -92,8 +92,8 @@ export class UserSettingsThemes /*extends AbstractViewSettings*/ {
})
.on('onComplete', (id, result, data) => {
themeBackground.loading(false);
themeBackground.name(data?.Result?.Name || '');
themeBackground.hash(data?.Result?.Hash || '');
themeBackground.name(data?.Result?.name || '');
themeBackground.hash(data?.Result?.hash || '');
if (!themeBackground.name() || !themeBackground.hash()) {
let errorMsg = '';
if (data.ErrorCode) {

View file

@ -63,7 +63,7 @@ export const GnuPGUserStore = new class {
}
}
}, {
KeyId: key.id,
keyId: key.id,
isPrivate: isPrivate
}
);
@ -77,7 +77,7 @@ export const GnuPGUserStore = new class {
showScreenPopup(OpenPgpKeyPopupView, [key]);
}
}, {
KeyId: key.id,
keyId: key.id,
isPrivate: isPrivate,
Passphrase: pass
}
@ -166,7 +166,7 @@ export const GnuPGUserStore = new class {
const
pgpInfo = message.pgpEncrypted();
if (pgpInfo) {
let ids = [message.to[0].email].concat(pgpInfo.KeyIds),
let ids = [message.to[0].email].concat(pgpInfo.keyIds),
i = ids.length, key;
while (i--) {
key = findGnuPGKey(this.privateKeys, ids[i]);
@ -177,10 +177,10 @@ export const GnuPGUserStore = new class {
if (key) {
// Also check message.from[0].email
let params = {
Folder: message.folder,
Uid: message.uid,
PartId: pgpInfo.PartId,
KeyId: key.id,
folder: message.folder,
uid: message.uid,
partId: pgpInfo.PartId,
keyId: key.id,
Passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'),
Data: '' // message.plain() optional
}
@ -195,13 +195,13 @@ export const GnuPGUserStore = new class {
}
async verify(message) {
let data = message.pgpSigned(); // { BodyPartId: "1", SigPartId: "2", MicAlg: "pgp-sha256" }
let data = message.pgpSigned(); // { bodyPartId: "1", sigPartId: "2", micAlg: "pgp-sha256" }
if (data) {
data = { ...data }; // clone
// const sender = message.from[0].email;
// let mode = await this.hasPublicKeyForEmails([sender]);
data.Folder = message.folder;
data.Uid = message.uid;
data.folder = message.folder;
data.uid = message.uid;
if (data.BodyPart) {
data.BodyPart = data.BodyPart.raw;
data.SigPart = data.SigPart.body;

View file

@ -47,7 +47,7 @@ addObservablesTo(MessagelistUserStore, {
page: 1,
pageBeforeThread: 1,
error: '',
// Folder: '',
// folder: '',
endHash: '',
endThreadUid: 0,
@ -69,17 +69,17 @@ addComputablesTo(MessagelistUserStore, {
return value;
},
isArchiveFolder: () => FolderUserStore.archiveFolder() === MessagelistUserStore().Folder,
isArchiveFolder: () => FolderUserStore.archiveFolder() === MessagelistUserStore().folder,
isDraftFolder: () => FolderUserStore.draftsFolder() === MessagelistUserStore().Folder,
isDraftFolder: () => FolderUserStore.draftsFolder() === MessagelistUserStore().folder,
isSentFolder: () => FolderUserStore.sentFolder() === MessagelistUserStore().Folder,
isSentFolder: () => FolderUserStore.sentFolder() === MessagelistUserStore().folder,
isSpamFolder: () => FolderUserStore.spamFolder() === MessagelistUserStore().Folder,
isSpamFolder: () => FolderUserStore.spamFolder() === MessagelistUserStore().folder,
isTrashFolder: () => FolderUserStore.trashFolder() === MessagelistUserStore().Folder,
isTrashFolder: () => FolderUserStore.trashFolder() === MessagelistUserStore().folder,
archiveAllowed: () => ![UNUSED_OPTION_VALUE, MessagelistUserStore().Folder].includes(FolderUserStore.archiveFolder())
archiveAllowed: () => ![UNUSED_OPTION_VALUE, MessagelistUserStore().folder].includes(FolderUserStore.archiveFolder())
&& !MessagelistUserStore.isDraftFolder(),
canMarkAsSpam: () => !(UNUSED_OPTION_VALUE === FolderUserStore.spamFolder()
@ -147,14 +147,14 @@ MessagelistUserStore.notifyNewMessages = (folder, newMessages) => {
i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
COUNT: len
}),
{ Url: mailBox(newMessages[0].Folder) }
{ Url: mailBox(newMessages[0].folder) }
);
} else {
newMessages.forEach(item => {
NotificationUserStore.display(
EmailCollectionModel.reviveFromJson(item.From).toString(),
EmailCollectionModel.reviveFromJson(item.from).toString(),
item.subject,
{ Folder: item.Folder, Uid: item.Uid }
{ folder: item.folder, uid: item.uid }
);
});
}
@ -208,12 +208,12 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
let unreadCountChange = false;
const
folder = getFolderFromCacheList(collection.Folder),
folder = getFolderFromCacheList(collection.folder),
folderInfo = collection.folderInfo;
if (folder && !bCached) {
// folder.revivePropertiesFromJson(result);
folder.expires = Date.now();
folder.uidNext = folderInfo.UidNext;
folder.uidNext = folderInfo.uidNext;
folder.hash = collection.folderHash;
if (null != folderInfo.totalEmails) {
@ -228,8 +228,8 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
folder.unreadEmails(folderInfo.unreadEmails);
}
folder.flags(folderInfo.Flags);
let flags = folderInfo.PermanentFlags;
folder.flags(folderInfo.flags);
let flags = folderInfo.permanentFlags;
if (flags.includes('\\*')) {
let i = 6;
while (--i) {
@ -253,14 +253,14 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
MessagelistUserStore.threadUid(collection.threadUid);
MessagelistUserStore.endHash(
collection.Folder +
collection.folder +
'|' + collection.search +
'|' + MessagelistUserStore.threadUid() +
'|' + MessagelistUserStore.page()
);
MessagelistUserStore.endThreadUid(collection.threadUid);
const message = MessageUserStore.message();
if (message && collection.Folder !== message.folder) {
if (message && collection.folder !== message.folder) {
MessageUserStore.message(null);
}
@ -330,7 +330,7 @@ MessagelistUserStore.setAction = (sFolderFullName, iSetAction, messages) => {
folder.unreadEmails(folder.unreadEmails() - alreadyUnread + length);
}
Remote.request('MessageSetSeen', null, {
Folder: sFolderFullName,
folder: sFolderFullName,
Uids: rootUids.join(','),
SetAction: iSetAction == MessageSetAction.SetSeen ? 1 : 0
});
@ -339,7 +339,7 @@ MessagelistUserStore.setAction = (sFolderFullName, iSetAction, messages) => {
case MessageSetAction.SetFlag:
case MessageSetAction.UnsetFlag:
Remote.request('MessageSetFlagged', null, {
Folder: sFolderFullName,
folder: sFolderFullName,
Uids: rootUids.join(','),
SetAction: iSetAction == MessageSetAction.SetFlag ? 1 : 0
});

View file

@ -11,7 +11,7 @@ const HTML5Notification = window.Notification,
NotificationsGranted = () => 'granted' === HTML5NotificationStatus(),
dispatchMessage = data => {
focus();
if (data.Folder && data.Uid) {
if (data.folder && data.uid) {
fireEvent('mailbox.message.show', data);
} else if (data.Url) {
hasher.setHash(data.Url);
@ -60,8 +60,8 @@ export const NotificationUserStore = new class {
icon: imageSrc || Links.staticLink('css/images/icon-message-notification.png'),
data: messageData
};
if (messageData?.Uid) {
options.tag = messageData.Uid;
if (messageData?.uid) {
options.tag = messageData.uid;
}
if (WorkerNotifications) {
// Service-Worker-Allowed HTTP header to allow the scope.

View file

@ -214,14 +214,14 @@ export const OpenPGPUserStore = new class {
* https://docs.openpgpjs.org/#sign-and-verify-cleartext-messages
*/
async verify(message) {
const data = message.pgpSigned(), // { BodyPartId: "1", SigPartId: "2", MicAlg: "pgp-sha256" }
const data = message.pgpSigned(), // { bodyPartId: "1", sigPartId: "2", micAlg: "pgp-sha256" }
publicKey = this.publicKeys().find(key => key.emails.includes(message.from[0].email));
if (data && publicKey) {
data.Folder = message.folder;
data.Uid = message.uid;
data.folder = message.folder;
data.uid = message.uid;
data.GnuPG = 0;
let response;
if (data.SigPartId) {
if (data.sigPartId) {
response = await Remote.post('MessagePgpVerify', null, data);
} else if (data.BodyPart) {
response = { Result: { text: data.BodyPart.raw, signature: data.SigPart.body } };

View file

@ -198,7 +198,7 @@ export const
gnupg = GnuPGUserStore.hasPublicKeyForEmails([sender]),
openpgp = OpenPGPUserStore.hasPublicKeyForEmails([sender]);
// Detached signature use GnuPG first, else we must download whole message
if (gnupg && signed.SigPartId) {
if (gnupg && signed.sigPartId) {
return GnuPGUserStore.verify(message);
}
if (openpgp) {

View file

@ -514,7 +514,7 @@ export class ComposePopupView extends AbstractViewPopup {
this.saving(false);
if (!iError) {
if (oData.Result.NewFolder && oData.Result.NewUid) {
if (oData.Result.folder && oData.Result.uid) {
result = true;
if (this.bFromDraft) {
@ -524,8 +524,8 @@ export class ComposePopupView extends AbstractViewPopup {
}
}
this.draftsFolder(oData.Result.NewFolder);
this.draftUid(oData.Result.NewUid);
this.draftsFolder(oData.Result.folder);
this.draftUid(oData.Result.uid);
this.savedTime(new Date);
@ -968,7 +968,7 @@ export class ComposePopupView extends AbstractViewPopup {
this.setFocusInPopup();
}
// item.CID item.isInline item.isLinked
// item.cId item.isInline item.isLinked
const downloads = this.attachments.filter(item => item && !item.tempName()).map(item => item.id);
if (arrayLength(downloads)) {
Remote.request('MessageUploadAttachments',
@ -984,14 +984,14 @@ export class ComposePopupView extends AbstractViewPopup {
if (iError || !result?.[index]) {
attachment.error(getUploadErrorDescByCode(UploadErrorCode.NoFileUploaded));
} else {
attachment.tempName(result[index].TempName);
attachment.type(result[index].MimeType);
attachment.tempName(result[index].tempName);
attachment.type(result[index].mimeType);
}
}
});
},
{
Attachments: downloads
attachments: downloads
},
999000
);
@ -1058,10 +1058,10 @@ export class ComposePopupView extends AbstractViewPopup {
this.dragAndDropOver(false);
const
size = pInt(oData.Size, null),
size = pInt(oData.size, null),
attachment = new ComposeAttachmentModel(
sId,
oData.FileName ? oData.FileName.toString() : '',
oData.fileName ? oData.fileName.toString() : '',
size
);
@ -1113,11 +1113,11 @@ export class ComposePopupView extends AbstractViewPopup {
.waiting(false)
.uploading(false)
.complete(true);
attachment.fileName(attachmentJson.Name);
attachment.size(attachmentJson.Size ? pInt(attachmentJson.Size) : 0);
attachment.tempName(attachmentJson.TempName ? attachmentJson.TempName : '');
attachment.fileName(attachmentJson.name);
attachment.size(attachmentJson.size ? pInt(attachmentJson.size) : 0);
attachment.tempName(attachmentJson.tempName ? attachmentJson.tempName : '');
attachment.isInline = false;
attachment.type(attachmentJson.MimeType);
attachment.type(attachmentJson.mimeType);
}
}
});
@ -1227,7 +1227,7 @@ export class ComposePopupView extends AbstractViewPopup {
item.estimatedSize,
item.isInline(),
item.isLinked(),
item.cid,
item.cId,
item.contentLocation
);
attachment.fromMessage = true;
@ -1395,7 +1395,7 @@ export class ComposePopupView extends AbstractViewPopup {
attachments[item.tempName()] = {
name: item.fileName(),
inline: item.isInline,
cid: item.CID,
cId: item.cId,
location: item.contentLocation,
type: item.mimeType()
};
@ -1405,32 +1405,32 @@ export class ComposePopupView extends AbstractViewPopup {
const
identity = this.currentIdentity(),
params = {
IdentityID: identity.id(),
MessageFolder: this.draftsFolder(),
MessageUid: this.draftUid(),
SaveFolder: sSaveFolder,
From: this.from(),
To: this.to(),
Cc: this.cc(),
Bcc: this.bcc(),
ReplyTo: this.replyTo(),
identityID: identity.id(),
messageFolder: this.draftsFolder(),
messageUid: this.draftUid(),
saveFolder: sSaveFolder,
from: this.from(),
to: this.to(),
cc: this.cc(),
bcc: this.bcc(),
replyTo: this.replyTo(),
subject: this.subject(),
DraftInfo: this.aDraftInfo,
InReplyTo: this.sInReplyTo,
References: this.sReferences,
MarkAsImportant: this.markAsImportant() ? 1 : 0,
Attachments: attachments,
draftInfo: this.aDraftInfo,
inReplyTo: this.sInReplyTo,
references: this.sReferences,
markAsImportant: this.markAsImportant() ? 1 : 0,
attachments: attachments,
// Only used at send, not at save:
Dsn: this.requestDsn() ? 1 : 0,
ReadReceiptRequest: this.requestReadReceipt() ? 1 : 0
dsn: this.requestDsn() ? 1 : 0,
readReceiptRequest: this.requestReadReceipt() ? 1 : 0
},
recipients = draft ? [identity.email()] : this.allRecipients(),
sign = !draft && this.pgpSign() && this.canPgpSign(),
encrypt = this.pgpEncrypt() && this.canPgpEncrypt(),
TextIsHtml = this.oEditor.isHtml();
isHtml = this.oEditor.isHtml();
let Text = this.oEditor.getData();
if (TextIsHtml) {
if (isHtml) {
let l;
do {
l = Text.length;
@ -1440,27 +1440,27 @@ export class ComposePopupView extends AbstractViewPopup {
// Remove hubspot data-hs- attributes
.replace(/(<[^>]+)\s+data-hs-[a-z-]+=("[^"]+"|'[^']+')/gi, '$1');
} while (l != Text.length)
params.Html = Text;
params.Text = htmlToPlain(Text);
params.html = Text;
params.plain = htmlToPlain(Text);
} else {
params.Text = Text;
params.plain = Text;
}
if (this.mailvelope && 'mailvelope' === this.viewArea()) {
params.Encrypted = draft
params.encrypted = draft
? await this.mailvelope.createDraft()
: await this.mailvelope.encrypt(recipients);
} else if (sign || encrypt) {
let data = new MimePart;
data.headers['Content-Type'] = 'text/'+(TextIsHtml?'html':'plain')+'; charset="utf-8"';
data.headers['Content-Type'] = 'text/'+(isHtml?'html':'plain')+'; charset="utf-8"';
data.headers['Content-Transfer-Encoding'] = 'base64';
data.body = base64_encode(Text);
if (TextIsHtml) {
if (isHtml) {
const alternative = new MimePart, plain = new MimePart;
alternative.headers['Content-Type'] = 'multipart/alternative';
plain.headers['Content-Type'] = 'text/plain; charset="utf-8"';
plain.headers['Content-Transfer-Encoding'] = 'base64';
plain.body = base64_encode(params.Text);
plain.body = base64_encode(params.plain);
// First add plain
alternative.children.push(plain);
// Now add HTML
@ -1470,7 +1470,7 @@ export class ComposePopupView extends AbstractViewPopup {
if (!draft && sign?.[1]) {
if ('openpgp' == sign[0]) {
// Doesn't sign attachments
params.Html = params.Text = '';
params.html = params.plain = '';
let signed = new MimePart;
signed.headers['Content-Type'] =
'multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"';
@ -1481,14 +1481,14 @@ export class ComposePopupView extends AbstractViewPopup {
signature.headers['Content-Transfer-Encoding'] = '7Bit';
signature.body = await OpenPGPUserStore.sign(data.toString(), sign[1], 1);
signed.children.push(signature);
params.Signed = signed.toString();
params.signed = signed.toString();
params.Boundary = signed.boundary;
data = signed;
} else if ('gnupg' == sign[0]) {
// TODO: sign in PHP fails
// params.SignData = data.toString();
params.SignFingerprint = sign[1].fingerprint;
params.SignPassphrase = await GnuPGUserStore.sign(sign[1]);
// params.signData = data.toString();
params.signFingerprint = sign[1].fingerprint;
params.signPassphrase = await GnuPGUserStore.sign(sign[1]);
} else {
throw 'Signing with ' + sign[0] + ' not yet implemented';
}
@ -1496,11 +1496,11 @@ export class ComposePopupView extends AbstractViewPopup {
if (encrypt) {
if ('openpgp' == encrypt) {
// Doesn't encrypt attachments
params.Encrypted = await OpenPGPUserStore.encrypt(data.toString(), recipients);
params.Signed = '';
params.encrypted = await OpenPGPUserStore.encrypt(data.toString(), recipients);
params.signed = '';
} else if ('gnupg' == encrypt) {
// Does encrypt attachments
params.EncryptFingerprints = JSON.stringify(GnuPGUserStore.getPublicKeyFingerprints(recipients));
params.encryptFingerprints = JSON.stringify(GnuPGUserStore.getPublicKeyFingerprints(recipients));
} else {
throw 'Encryption with ' + encrypt + ' not yet implemented';
}

View file

@ -43,7 +43,7 @@ export class FolderClearPopupView extends AbstractViewPopup {
this.clearing(false);
iError ? alert(getNotification(iError)) : this.close();
}, {
Folder: folder.fullName
folder: folder.fullName
});
}
}

View file

@ -46,11 +46,11 @@ export class FolderCreatePopupView extends AbstractViewPopup {
submitForm(form) {
if (form.reportValidity()) {
const data = new FormData(form);
data.set('Subscribe', this.folderSubscribe() ? 1 : 0);
data.set('subscribe', this.folderSubscribe() ? 1 : 0);
let parentFolderName = this.selectedParentValue();
if (!parentFolderName && 1 < FolderUserStore.namespace.length) {
data.set('Parent', FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1));
data.set('parent', FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1));
}
Remote.abort('Folders').post('FolderCreate', FolderUserStore.foldersCreating, data)

View file

@ -297,7 +297,7 @@ export class MailMessageList extends AbstractViewRight {
);
addEventListener('mailbox.message.show', e => {
const sFolder = e.detail.Folder, iUid = e.detail.Uid;
const sFolder = e.detail.folder, iUid = e.detail.uid;
const message = MessagelistUserStore.find(
item => sFolder === item?.folder && iUid == item?.uid
@ -370,12 +370,12 @@ export class MailMessageList extends AbstractViewRight {
if (hashes.length) {
Remote.post('AttachmentsActions', null, {
Do: 'Zip',
Folder: MessagelistUserStore().Folder,
folder: MessagelistUserStore().folder,
// Uids: uids,
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.FileHash;
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
@ -403,7 +403,7 @@ export class MailMessageList extends AbstractViewRight {
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.FileHash;
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
@ -504,7 +504,7 @@ export class MailMessageList extends AbstractViewRight {
MessageFlagsCache.clearFolder(sFolderFullName);
Remote.request('MessageSetSeenToAll', null, {
Folder: sFolderFullName,
folder: sFolderFullName,
SetAction: 1,
ThreadUids: uids.join(',')
});

View file

@ -492,7 +492,7 @@ export class MailMessageView extends AbstractViewRight {
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.FileHash;
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
@ -534,11 +534,11 @@ export class MailMessageView extends AbstractViewRight {
MessagelistUserStore.reloadFlagsAndCachedMessage();
}
}, {
MessageFolder: oMessage.folder,
MessageUid: oMessage.uid,
ReadReceipt: oMessage.readReceipt(),
messageFolder: oMessage.folder,
messageUid: oMessage.uid,
readReceipt: oMessage.readReceipt(),
subject: i18n('READ_RECEIPT/SUBJECT', { SUBJECT: oMessage.subject() }),
Text: i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountUserStore.email() })
plain: i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountUserStore.email() })
});
}
}