mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +03:00
Improved inline attachments visibility to prevent questions
This commit is contained in:
parent
aa357af4c5
commit
02eb5ad4e8
4 changed files with 17 additions and 19 deletions
|
|
@ -20,7 +20,6 @@ export class AttachmentModel extends AbstractModel {
|
|||
this.fileName = '';
|
||||
this.fileNameExt = '';
|
||||
this.fileType = FileType.Unknown;
|
||||
this.friendlySize = '';
|
||||
this.isThumbnail = false;
|
||||
this.cid = '';
|
||||
this.contentLocation = '';
|
||||
|
|
@ -29,6 +28,7 @@ export class AttachmentModel extends AbstractModel {
|
|||
this.uid = '';
|
||||
this.url = '';
|
||||
this.mimeIndex = '';
|
||||
this.estimatedSize = 0;
|
||||
this.framed = false;
|
||||
|
||||
this.addObservables({
|
||||
|
|
@ -45,14 +45,16 @@ export class AttachmentModel extends AbstractModel {
|
|||
static reviveFromJson(json) {
|
||||
const attachment = super.reviveFromJson(json);
|
||||
if (attachment) {
|
||||
attachment.friendlySize = FileInfo.friendlySize(json.EstimatedSize);
|
||||
|
||||
attachment.fileNameExt = FileInfo.getExtension(attachment.fileName);
|
||||
attachment.fileType = FileInfo.getType(attachment.fileNameExt, attachment.mimeType);
|
||||
}
|
||||
return attachment;
|
||||
}
|
||||
|
||||
friendlySize() {
|
||||
return FileInfo.friendlySize(this.estimatedSize) + (this.isLinked() ? ' 🔗' : '');
|
||||
}
|
||||
|
||||
contentId() {
|
||||
return this.cid.replace(/^<+|>+$/g, '');
|
||||
}
|
||||
|
|
@ -85,13 +87,6 @@ export class AttachmentModel extends AbstractModel {
|
|||
return FileType.Audio === this.fileType && 'wav' === this.fileNameExt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasThumbnail() {
|
||||
return this.isThumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
|
@ -142,7 +137,10 @@ export class AttachmentModel extends AbstractModel {
|
|||
* @returns {string}
|
||||
*/
|
||||
linkThumbnailPreviewStyle() {
|
||||
return this.hasThumbnail() ? 'background:url(' + serverRequestRaw('ViewThumbnail', this.download) + ')' : '';
|
||||
// return (this.isThumbnail && !this.isLinked())
|
||||
return this.isThumbnail
|
||||
? 'background:url(' + serverRequestRaw('ViewThumbnail', this.download) + ')'
|
||||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue