mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Resolve #1332
This commit is contained in:
parent
638755bef3
commit
2916583d0b
6 changed files with 28 additions and 26 deletions
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
import { arrayLength } from 'Common/Utils';
|
||||
|
||||
export const RFC822 = 'message/rfc822';
|
||||
|
||||
const
|
||||
cache = {},
|
||||
app = 'application/',
|
||||
|
|
@ -12,8 +14,8 @@ const
|
|||
lowerCase = text => text.toLowerCase().trim(),
|
||||
|
||||
exts = {
|
||||
eml: 'message/rfc822',
|
||||
mime: 'message/rfc822',
|
||||
eml: RFC822,
|
||||
mime: RFC822,
|
||||
vcard: 'text/vcard',
|
||||
vcf: 'text/vcard',
|
||||
htm: 'text/html',
|
||||
|
|
@ -188,7 +190,7 @@ export const FileInfo = {
|
|||
case ['php', 'js', 'css', 'xml', 'html'].includes(ext) || 'text/html' == mimeType:
|
||||
result = FileType.Code;
|
||||
break;
|
||||
case 'eml' == ext || ['message/delivery-status', 'message/rfc822'].includes(mimeType):
|
||||
case 'eml' == ext || ['message/delivery-status', RFC822].includes(mimeType):
|
||||
result = FileType.Eml;
|
||||
break;
|
||||
case 'ics' == ext || mimeType == 'text/calendar':
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { RFC822 } from 'Common/File';
|
||||
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||
import { isArray, arrayLength } from 'Common/Utils';
|
||||
import {
|
||||
getFolderInboxName,
|
||||
getFolderFromCacheList
|
||||
} from 'Common/Cache';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
import { MessagelistUserStore } from 'Stores/User/Messagelist';
|
||||
|
|
@ -194,7 +192,7 @@ folderInformationMultiply = (boot = false) => {
|
|||
dropFilesInFolder = (sFolderFullName, files) => {
|
||||
let count = files.length;
|
||||
for (const file of files) {
|
||||
if ('message/rfc822' === file.type) {
|
||||
if (RFC822 === file.type) {
|
||||
let data = new FormData;
|
||||
data.append('folder', sFolderFullName);
|
||||
data.append('appendFile', file);
|
||||
|
|
|
|||
3
dev/External/User/ko.js
vendored
3
dev/External/User/ko.js
vendored
|
|
@ -1,5 +1,6 @@
|
|||
import 'External/ko';
|
||||
import ko from 'ko';
|
||||
import { RFC822 } from 'Common/File';
|
||||
import { HtmlEditor } from 'Common/Html';
|
||||
import { timeToNode } from 'Common/Translator';
|
||||
import { doc, elementById, addEventsListeners, dropdowns, leftPanelDisabled } from 'Common/Globals';
|
||||
|
|
@ -43,7 +44,7 @@ const rlContentType = 'snappymail/action',
|
|||
let files = false;
|
||||
// if (e.dataTransfer.types.includes('Files'))
|
||||
for (const item of e.dataTransfer.items) {
|
||||
files |= 'file' === item.kind && 'message/rfc822' === item.type;
|
||||
files |= 'file' === item.kind && RFC822 === item.type;
|
||||
}
|
||||
if (files || dragMessages()) {
|
||||
e.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { addObservablesTo, addComputablesTo } from 'External/ko';
|
|||
import { FolderUserStore, isAllowedKeyword } from 'Stores/User/Folder';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
|
||||
import { FileInfo } from 'Common/File';
|
||||
import { FileInfo, RFC822 } from 'Common/File';
|
||||
import { AttachmentCollectionModel } from 'Model/AttachmentCollection';
|
||||
import { EmailCollectionModel } from 'Model/EmailCollection';
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
|
@ -186,7 +186,7 @@ export class MessageModel extends AbstractModel {
|
|||
return b64EncodeJSONSafe({
|
||||
folder: this.folder,
|
||||
uid: this.uid,
|
||||
mimeType: 'message/rfc822',
|
||||
mimeType: RFC822,
|
||||
fileName: (this.subject() || 'message-' + this.hash) + '.eml',
|
||||
accountHash: SettingsGet('accountHash')
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,19 +2,16 @@ import ko from 'ko';
|
|||
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||
|
||||
import { ScopeFolderList, ScopeMessageList, ScopeMessageView } from 'Common/Enums';
|
||||
|
||||
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
|
||||
|
||||
import { doc,
|
||||
leftPanelDisabled, toggleLeftPanel,
|
||||
Settings, SettingsCapa,
|
||||
addEventsListeners, stopEvent,
|
||||
addShortcut, registerShortcut, formFieldFocused
|
||||
} from 'Common/Globals';
|
||||
|
||||
import { arrayLength } from 'Common/Utils';
|
||||
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, downloadZip, moveAction } from 'Common/UtilsUser';
|
||||
import { FileInfo } from 'Common/File';
|
||||
import { FileInfo, RFC822 } from 'Common/File';
|
||||
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
|
||||
|
||||
import { mailBox } from 'Common/Links';
|
||||
|
|
@ -610,7 +607,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
const dropZone = dom.querySelector('.listDragOver'),
|
||||
validFiles = oEvent => {
|
||||
for (const item of oEvent.dataTransfer.items) {
|
||||
if ('file' === item.kind && 'message/rfc822' === item.type) {
|
||||
if ('file' === item.kind && RFC822 === item.type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
FolderType,
|
||||
MessageSetAction
|
||||
} from 'Common/EnumsUser';
|
||||
|
||||
import { RFC822 } from 'Common/File';
|
||||
import {
|
||||
elementById,
|
||||
keyScopeReal,
|
||||
|
|
@ -292,7 +292,19 @@ export class MailMessageView extends AbstractViewRight {
|
|||
return;
|
||||
}
|
||||
|
||||
if (eqs(event, '.attachmentsPlace .showPreview')) {
|
||||
el = eqs(event, '.attachmentsPlace .showPreview');
|
||||
if (el) {
|
||||
const attachment = ko.dataFor(el), url = attachment?.linkDownload();
|
||||
// if (url && FileType.Eml === attachment.fileType) {
|
||||
if (url && RFC822 == attachment.mimeType) {
|
||||
stopEvent(event);
|
||||
fetchRaw(url).then(text => {
|
||||
const oMessage = new MessageModel();
|
||||
MimeToMessage(text, oMessage);
|
||||
// cleanHTML
|
||||
oMessage.popupMessage();
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -326,14 +338,6 @@ export class MailMessageView extends AbstractViewRight {
|
|||
fetchRaw(url).then(text =>
|
||||
showScreenPopup(OpenPgpImportPopupView, [text])
|
||||
);
|
||||
} else if ('message/rfc822' == attachment.mimeType) {
|
||||
// TODO
|
||||
fetchRaw(url).then(text => {
|
||||
const oMessage = new MessageModel();
|
||||
MimeToMessage(text, oMessage);
|
||||
// cleanHTML
|
||||
oMessage.popupMessage();
|
||||
});
|
||||
} else {
|
||||
download(url, attachment.fileName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue