Skip to content

Commit

Permalink
fix(Felamimail/js): get record title from renderer promise
Browse files Browse the repository at this point in the history
  • Loading branch information
ccheng-dev committed Jun 27, 2024
1 parent 6466c25 commit fa1656d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tine20/Felamimail/css/Felamimail.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
}

.preview-panel-felamimail-attachments {
margin-top: 5px;
margin: 5px 0;
padding: 3px;
background-color: #e8e8e8;
}
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 9 additions & 6 deletions tine20/Felamimail/js/MailDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Ext.extend(Tine.Felamimail.MailDetailsPanel, Ext.Panel, {
'<div class="preview-panel-felamimail">',
'{[this.showInfo(values)]}',
'{[this.showAttachments(values.attachments, values)]}',
'<div class="preview-panel-felamimail-filelocations">{[this.showFileLocations(values)]}</div>',
'{[this.showFileLocations(values)]}',
'<div class="preview-panel-felamimail-preparedPart"></div>',
'<div class="preview-panel-felamimail-body">{[this.showBody(values.body, values)]}</div>',
'</div>',{
Expand Down Expand Up @@ -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 '';
}
Expand Down
13 changes: 9 additions & 4 deletions tine20/Felamimail/js/MessageFileAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down

0 comments on commit fa1656d

Please sign in to comment.