diff --git a/dev/Common/UtilsUser.js b/dev/Common/UtilsUser.js index 14e8ce396..c9813674d 100644 --- a/dev/Common/UtilsUser.js +++ b/dev/Common/UtilsUser.js @@ -250,7 +250,7 @@ setLayoutResizer = (source, target, sClientSideKeyName, mode) => populateMessageBody = (oMessage, popup) => { if (oMessage) { - popup || MessageUserStore.hideMessageBodies(); + popup || MessageUserStore.message(oMessage); popup || MessageUserStore.loading(true); Remote.message((iError, oData/*, bCached*/) => { if (iError) { @@ -276,9 +276,9 @@ populateMessageBody = (oMessage, popup) => { MessageFlagsCache.initMessage(oMessage); // Set clone - MessageUserStore.message(MessageModel.fromMessageListItem(oMessage)); - oMessage = MessageUserStore.message(); + oMessage = MessageModel.fromMessageListItem(oMessage); } + MessageUserStore.message(oMessage); } if (oMessage && oMessage.uid == json.Uid) { @@ -289,6 +289,7 @@ populateMessageBody = (oMessage, popup) => { } */ isNew || oMessage.revivePropertiesFromJson(json); + if (messagesDom) { let id = 'rl-msg-' + oMessage.hash.replace(/[^a-zA-Z0-9]/g, ''), body = elementById(id); @@ -312,11 +313,7 @@ populateMessageBody = (oMessage, popup) => { messagesDom.append(body); - if (!popup) { - MessageUserStore.activeDom(body); - MessageUserStore.hideMessageBodies(); - oMessage.body.hidden = false; - } + popup || (oMessage.body.hidden = false); popup && oMessage.viewPopupMessage(); } diff --git a/dev/Mime/Utils.js b/dev/Mime/Utils.js index c994236dd..1da97e10f 100644 --- a/dev/Mime/Utils.js +++ b/dev/Mime/Utils.js @@ -48,7 +48,6 @@ export function MimeToMessage(data, message) attachment.folder = ''; attachment.uid = ''; attachment.mimeIndex = part.id; - attachment.framed = false; */ attachment.cid = cid ? cid.value : ''; if (cid && html) { diff --git a/dev/Model/Attachment.js b/dev/Model/Attachment.js index 9974ba6d7..7872c59b6 100644 --- a/dev/Model/Attachment.js +++ b/dev/Model/Attachment.js @@ -29,7 +29,6 @@ export class AttachmentModel extends AbstractModel { this.url = ''; this.mimeIndex = ''; this.estimatedSize = 0; - this.framed = false; this.addObservables({ isInline: false, diff --git a/dev/Screen/User/MailBox.js b/dev/Screen/User/MailBox.js index 77f932a36..44d9380ad 100644 --- a/dev/Screen/User/MailBox.js +++ b/dev/Screen/User/MailBox.js @@ -11,7 +11,6 @@ import { AppUserStore } from 'Stores/User/App'; import { AccountUserStore } from 'Stores/User/Account'; import { FolderUserStore } from 'Stores/User/Folder'; import { MessagelistUserStore } from 'Stores/User/Messagelist'; -import { MessageUserStore } from 'Stores/User/Message'; import { ThemeStore } from 'Stores/Theme'; import { SystemDropDownUserView } from 'View/User/SystemDropDown'; @@ -83,8 +82,7 @@ export class MailBoxUserScreen extends AbstractScreen { let message = new MessageModel; message.folder = folderHash; message.uid = messageUid; - MessageUserStore.message(message); - populateMessageBody(MessageUserStore.message()); + populateMessageBody(message); } else { let threadUid = folderHash.replace(/^.+~(\d+)$/, '$1'); MessagelistUserStore.threadUid((folderHash === threadUid) ? 0 : pInt(threadUid)); diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index 3b1750d1d..e9345936b 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -15,8 +15,7 @@ export const MessageUserStore = new class { loading: false, // Cache mail bodies - bodiesDom: null, - activeDom: null + bodiesDom: null }); // Subscribers @@ -30,8 +29,8 @@ export const MessageUserStore = new class { } else { AppUserStore.focusedState(Scope.MessageList); exitFullscreen(); - this.hideMessageBodies(); } + this.hideMessageBodies(); }, }); diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 068de0e9d..2c503c405 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -160,8 +160,7 @@ export class MailMessageList extends AbstractViewRight { this.selector.on('ItemSelect', message => { if (message) { - MessageUserStore.message(MessageModel.fromMessageListItem(message)); - populateMessageBody(MessageUserStore.message()); + populateMessageBody(MessageModel.fromMessageListItem(message)); } else { MessageUserStore.message(null); } @@ -246,8 +245,7 @@ export class MailMessageList extends AbstractViewRight { let message = new MessageModel; message.folder = sFolder; message.uid = iUid; - MessageUserStore.message(message); - populateMessageBody(MessageUserStore.message()); + populateMessageBody(message); } else { MessageUserStore.message(null); } @@ -679,7 +677,7 @@ export class MailMessageList extends AbstractViewRight { return false; }); addShortcut('tab,arrowright', '', Scope.MessageList, () => { - if (MessageUserStore.message()){ + if (MessageUserStore.message()) { AppUserStore.focusedState(Scope.MessageView); return false; } diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index 6b7d4fa8a..1b9ae8048 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -176,8 +176,6 @@ export class MailMessageView extends AbstractViewRight { this.addSubscribables({ message: message => { - MessageUserStore.activeDom(null); - if (message) { if (this.viewHash !== message.hash) { this.scrollMessageToTop(); diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/AttachmentCollection.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/AttachmentCollection.php index 3a056d0d6..0b1992af7 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/AttachmentCollection.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/AttachmentCollection.php @@ -22,21 +22,4 @@ class AttachmentCollection extends \MailSo\Base\Collection assert($oAttachment instanceof Attachment); parent::append($oAttachment, $bToTop); } - - public function SpecData() : array - { - $aResult = array(); - foreach ($this as $oAttachment) { - $aResult[] = array( - '@Object' => 'Object/Attachment', - 'FileName' => $oAttachment->FileName(), - 'MimeType' => $oAttachment->MimeType(), - 'IsInline' => $oAttachment->IsInline() - ); - } - return array( - '@Object' => 'Collection/AttachmentCollection', - '@Collection' => $aResult - ); - } } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php index 62735be6d..a6f60ed6f 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php @@ -680,7 +680,7 @@ class Message implements \JsonSerializable 'ReadReceipt' => '', 'Autocrypt' => $this->sAutocrypt, - 'Attachments' => $this->oAttachments ? $this->oAttachments->SpecData() : null, + 'Attachments' => $this->oAttachments, 'Flags' => $aFlags, diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php index 41e3a6180..4058025eb 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php @@ -113,12 +113,6 @@ trait Response return $aResult; } - private function isFileHasFramedPreview(string $sFileName) : bool - { - $sExt = \MailSo\Base\Utils::GetFileExtension($sFileName); - return \in_array($sExt, array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx')); - } - private function isFileHasThumbnail(string $sFileName) : bool { static $aCache = array(); @@ -194,6 +188,8 @@ trait Response 'FileName' => (\strlen($sSubject) ? \MailSo\Base\Utils::SecureFileName($sSubject) : 'message-'.$mResult['Uid']) . '.eml' )); + $mResult['Attachments'] = $this->responseObject($mResponse->Attachments(), $sParent); + if ('Message' === $sParent) { $mResult['DraftInfo'] = $mResponse->DraftInfo(); @@ -208,8 +204,6 @@ trait Response $mResult['PgpSigned'] = $mResponse->PgpSigned(); $mResult['PgpEncrypted'] = $mResponse->PgpEncrypted(); - $mResult['Attachments'] = $this->responseObject($mResponse->Attachments(), $sParent); - $mResult['ReadReceipt'] = $mResponse->ReadReceipt(); if (\strlen($mResult['ReadReceipt']) && !\in_array('$forwarded', $mResult['Flags'])) @@ -241,7 +235,6 @@ trait Response if ($mResponse instanceof \MailSo\Mail\Attachment) { $mResult = $mResponse->jsonSerialize(); - $mResult['Framed'] = $this->isFileHasFramedPreview($mResult['FileName']); $mResult['IsThumbnail'] = $this->GetCapa(Capa::ATTACHMENT_THUMBNAILS) && $this->isFileHasThumbnail($mResult['FileName']); $mResult['Download'] = Utils::EncodeKeyValuesQ(array( 'V' => APP_VERSION, @@ -250,8 +243,7 @@ trait Response 'Uid' => $mResult['Uid'], 'MimeIndex' => $mResult['MimeIndex'], 'MimeType' => $mResult['MimeType'], - 'FileName' => $mResult['FileName'], - 'Framed' => $mResult['Framed'] + 'FileName' => $mResult['FileName'] )); return $mResult; }