From fa1656d981d0289fb676076ded52c4d74e552b0c Mon Sep 17 00:00:00 2001 From: ccheng-dev Date: Wed, 26 Jun 2024 11:41:49 +0200 Subject: [PATCH] fix(Felamimail/js): get record title from renderer promise --- tine20/Felamimail/css/Felamimail.css | 4 ++-- tine20/Felamimail/js/MailDetailsPanel.js | 15 +++++++++------ tine20/Felamimail/js/MessageFileAction.js | 13 +++++++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tine20/Felamimail/css/Felamimail.css b/tine20/Felamimail/css/Felamimail.css index cb252c13089..19d933cf131 100644 --- a/tine20/Felamimail/css/Felamimail.css +++ b/tine20/Felamimail/css/Felamimail.css @@ -178,7 +178,7 @@ } .preview-panel-felamimail-attachments { - margin-top: 5px; + margin: 5px 0; padding: 3px; background-color: #e8e8e8; } @@ -403,7 +403,7 @@ .preview-panel-felamimail-filelocations, .felamimail-compose-info .x-panel-body { background-color: #ffffaa; - border-radius: 5px; + padding: 3px 5px 3px 5px; } .felamimail-location { diff --git a/tine20/Felamimail/js/MailDetailsPanel.js b/tine20/Felamimail/js/MailDetailsPanel.js index 0bd525fe42a..693bd283548 100644 --- a/tine20/Felamimail/js/MailDetailsPanel.js +++ b/tine20/Felamimail/js/MailDetailsPanel.js @@ -181,7 +181,7 @@ Ext.extend(Tine.Felamimail.MailDetailsPanel, Ext.Panel, { '
', '{[this.showInfo(values)]}', '{[this.showAttachments(values.attachments, values)]}', - '
{[this.showFileLocations(values)]}
', + '{[this.showFileLocations(values)]}', '
', '
{[this.showBody(values.body, values)]}
', '
',{ @@ -317,15 +317,18 @@ Ext.extend(Tine.Felamimail.MailDetailsPanel, Ext.Panel, { showFileLocations: function(messageData) { let fileLocations = _.get(messageData, 'fileLocations', []); - + const fileLocationBlock = document.createElement('div'); + fileLocationBlock.className = 'preview-panel-felamimail-filelocations'; + if (fileLocations.length) { let app = Tine.Tinebase.appMgr.get('Felamimail'); - let text = app.formatMessage('{locationCount, plural, one {This message is filed at the following location} other {This message is filed at the following locations}}: {locationsHtml}', { + const html = Tine.Felamimail.MessageFileAction.getFileLocationText(fileLocations, ', '); + const text = app.formatMessage('{locationCount, plural, one {This message is filed at the following location} other {This message is filed at the following locations}}: {locationsHtml}', { locationCount: fileLocations.length, - locationsHtml: Tine.Felamimail.MessageFileAction.getFileLocationText(fileLocations, ', ') + locationsHtml: html }); - - return text; + fileLocationBlock.innerHTML = text; + return fileLocationBlock.outerHTML; } else { return ''; } diff --git a/tine20/Felamimail/js/MessageFileAction.js b/tine20/Felamimail/js/MessageFileAction.js index 181be4a303b..370630664d6 100644 --- a/tine20/Felamimail/js/MessageFileAction.js +++ b/tine20/Felamimail/js/MessageFileAction.js @@ -594,16 +594,21 @@ Ext.extend(Tine.Felamimail.MessageFileAction, Ext.Action, { items: new Tine.Tinebase.dialog.Dialog({ listeners: { scope: this, - apply: function(fileTarget) { - item.fileTarget = fileTarget; + apply: async function(fileTarget) { + item.fileTarget = await fileTarget; this.selectionHandler(item, e); } }, - getEventData: function(eventName) { + getEventData: async function (eventName) { if (eventName === 'apply') { const attachRecord = this.getForm().findField('attachRecord').selectedRecord; + // getTitle might need to registerReplacer + let title = attachRecord.getTitle(); + if (title && title.asString) { + title = await title.asString(); + } return { - record_title: attachRecord.getTitle(), + record_title: title, model: model, data: attachRecord.data, };