From 933d13c8b29649c52aea27f2448071df5067da27 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 1 Feb 2023 08:57:31 -0700 Subject: [PATCH] Mail: Only add attachment action to open in Collabora for files that should be opened in Collabora --- mail/js/app.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index ac4ac010c5..03e58466d7 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1125,24 +1125,27 @@ app.classes.mail = AppJS.extend( value: 'downloadAllToZip' } ]; - if (typeof this.egw.user('apps')['collabora'] !== "undefined") - { - actions.push({ - id: 'collabora', - label: 'Open', - icon: 'collabora/navbar', - value: 'collabora' - }); - } + const collabora = { + id: 'collabora', + label: 'Open', + icon: 'collabora/navbar', + value: 'collabora' + }; data.attachmentsBlockTitle = `${data.attachmentsBlock.length} attachments`; + sel_options.attachmentsBlock = {}; data.attachmentsBlock.forEach(_item => { _item.actions = 'downloadOneAsFile'; // for some reason label needs to be set explicitly for the dropdown button. It needs more investigation. _item.actionsDefaultLabel = 'Download'; + + if (typeof this.egw.user('apps')['collabora'] !== "undefined" && this.egw.isEditable(_item.type)) + { + sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [...actions, collabora]; + } }); - sel_options.attachmentsBlock = {actions: actions}; + sel_options.attachmentsBlock.actions = actions; } mailPreview.set_value({content:data, sel_options:sel_options});