mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
Cleanup Date.fromNow() and friendlySize()
This commit is contained in:
parent
2bd9528098
commit
a0f8ac0dad
7 changed files with 28 additions and 50 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { File, FileType } from 'Common/File';
|
||||
import { pInt, friendlySize } from 'Common/Utils';
|
||||
import {
|
||||
attachmentDownload,
|
||||
attachmentPreview,
|
||||
|
|
@ -26,7 +25,6 @@ class AttachmentModel extends AbstractModel {
|
|||
this.fileName = '';
|
||||
this.fileNameExt = '';
|
||||
this.fileType = FileType.Unknown;
|
||||
this.estimatedSize = 0;
|
||||
this.friendlySize = '';
|
||||
this.isInline = false;
|
||||
this.isLinked = false;
|
||||
|
|
@ -60,7 +58,6 @@ class AttachmentModel extends AbstractModel {
|
|||
if (json && 'Object/Attachment' === json['@Object']) {
|
||||
this.mimeType = ((json.MimeType || '').toLowerCase()).trim();
|
||||
this.fileName = json.FileName.trim();
|
||||
this.estimatedSize = pInt(json.EstimatedSize);
|
||||
// if it is inline
|
||||
this.isInline = !!json.IsInline;
|
||||
// if inline image is linked with CID in html
|
||||
|
|
@ -76,7 +73,7 @@ class AttachmentModel extends AbstractModel {
|
|||
this.mimeIndex = json.MimeIndex;
|
||||
this.framed = !!json.Framed;
|
||||
|
||||
this.friendlySize = friendlySize(this.estimatedSize);
|
||||
this.friendlySize = File.friendlySize(json.EstimatedSize);
|
||||
this.cidWithoutTags = this.cid.replace(/^<+/, '').replace(/>+$/, '');
|
||||
|
||||
this.fileNameExt = File.getExtension(this.fileName);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { pInt, friendlySize } from 'Common/Utils';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import { File } from 'Common/File';
|
||||
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
|
@ -51,7 +51,7 @@ class ComposeAttachmentModel extends AbstractModel {
|
|||
|
||||
this.friendlySize = ko.computed(() => {
|
||||
const localSize = this.size();
|
||||
return null === localSize ? '' : friendlySize(localSize);
|
||||
return null === localSize ? '' : File.friendlySize(localSize);
|
||||
});
|
||||
|
||||
this.mimeType = ko.computed(() => File.getContentType(this.fileName()));
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ import { i18n } from 'Common/Translator';
|
|||
|
||||
import {
|
||||
pInt,
|
||||
encodeHtml,
|
||||
friendlySize
|
||||
encodeHtml
|
||||
} from 'Common/Utils';
|
||||
|
||||
import { messageViewLink, messageDownloadLink } from 'Common/Links';
|
||||
|
|
@ -188,7 +187,7 @@ class MessageModel extends AbstractModel {
|
|||
* @returns {string}
|
||||
*/
|
||||
friendlySize() {
|
||||
return friendlySize(this.size());
|
||||
return File.friendlySize(this.size());
|
||||
}
|
||||
|
||||
computeSenderEmail() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue