Skip to content

Commit

Permalink
Merge branch 'pu/ccheng/rt_247046' into '2024.11'
Browse files Browse the repository at this point in the history
fix(Felamimail/js): open email documents via existing cache in cross window

See merge request tine20/tine20!6561
  • Loading branch information
ccheng-dev committed Feb 10, 2025
2 parents 7e7c1d3 + 86fb901 commit fe32cc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tine20/Felamimail/js/MailDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ Ext.extend(Tine.Felamimail.MailDetailsPanel, Ext.Panel, {
await Tine.Felamimail.getAttachmentCache(attachmentId, createPreviewInstantly)
.then(async (cache) => {
const cacheRecord = new Tine.Tinebase.Model.Tree_Node(cache.attachments[0]);
const isPreviewReady = cache.attachments[0].preview_count !== 0 && cache.attachments[0].path !== '';
attachment.cache = cacheRecord;

const isPreviewReady = cache.attachments[0].preview_count !== 0 && cache.attachments[0].path !== '';
if (isPreviewReady) {
attachment.isPreviewReady = true;
attachment.cache = cacheRecord;
}
return resolve({
cache: new Tine.Tinebase.Model.Tree_Node(cache.attachments[0]),
Expand Down
14 changes: 9 additions & 5 deletions tine20/OnlyOfficeIntegrator/js/editDocumentAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ Promise.all([

emailInterceptor: async function(config) {
const mask = await config.setWaitText(app.i18n._('Preparing Attachment...'));

if (config?.cachePromises) {

if (config?.cache) {
config.recordData = config.cache?.data || config.cache;
} else if (config?.cachePromises) {
// open document does not need to check preview status
await Promise.race(config.cachePromises)
.then((response) => {
config.recordData = response?.cache?.data;
await Promise.all(config?.cachePromises)
.then((responses) => {
const validPromise = responses.find((cachePromise) => !!cachePromise?.cache);
config.recordData = validPromise.cache.data;
})
.catch((e) => {
console.error(e);
Expand All @@ -49,6 +52,7 @@ Promise.all([
const win = Tine.OnlyOfficeIntegrator.OnlyOfficeEditDialog.openWindow({
// always validate cachePromises to get the correct recordData
cachePromises: record?.cachePromises,
cache: record?.data?.cache,
recordData: recordData,
id: record.id,
contentPanelConstructorInterceptor: record?.cachePromises ? this.emailInterceptor : null
Expand Down

0 comments on commit fe32cc9

Please sign in to comment.