summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2019-09-04 07:46:45 +0000
committerAlexandre Kühn <aku@odoo.com>2019-09-04 10:29:07 +0000
commite7aff236b8073b952a0e554d9897a8f88d5c4c91 (patch)
treefe81fb980d9afd2d1eceffc8a88abe6a69ac2fb4 /addons/mail/static/src
parent3ec676be002e4c68907f862c649d7fba6e2eb5e8 (diff)
[FIX] mail: no message attachment delete in discuss and chat window
Delete attachment from message makes only sense from chatter. Task-Id 2058455
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/thread_field.js1
-rw-r--r--addons/mail/static/src/js/thread_widget.js2
-rw-r--r--addons/mail/static/src/xml/thread.xml17
3 files changed, 16 insertions, 4 deletions
diff --git a/addons/mail/static/src/js/thread_field.js b/addons/mail/static/src/js/thread_field.js
index ab8023b06ad..ea64d1fc9e3 100644
--- a/addons/mail/static/src/js/thread_field.js
+++ b/addons/mail/static/src/js/thread_field.js
@@ -43,6 +43,7 @@ var ThreadField = AbstractField.extend({
displayOrder: ThreadWidget.ORDER.DESC,
displayDocumentLinks: false,
displayMarkAsRead: false,
+ hasMessageAttachmentDeletable: true,
squashCloseMessages: false,
});
diff --git a/addons/mail/static/src/js/thread_widget.js b/addons/mail/static/src/js/thread_widget.js
index e5902602a77..9550931ad95 100644
--- a/addons/mail/static/src/js/thread_widget.js
+++ b/addons/mail/static/src/js/thread_widget.js
@@ -68,6 +68,7 @@ var ThreadWidget = Widget.extend({
displayEmailIcons: true,
displayReplyIcons: false,
loadMoreOnScroll: false,
+ hasMessageAttachmentDeletable: false,
});
// options when the thread is disabled
this._disabledOptions = {
@@ -81,6 +82,7 @@ var ThreadWidget = Widget.extend({
displayEmailIcons: false,
displayReplyIcons: false,
loadMoreOnScroll: this._enabledOptions.loadMoreOnScroll,
+ hasMessageAttachmentDeletable: false,
};
this._selectedMessageID = null;
this._currentThreadID = null;
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml
index ef21b2c5ede..12d41ebd431 100644
--- a/addons/mail/static/src/xml/thread.xml
+++ b/addons/mail/static/src/xml/thread.xml
@@ -254,6 +254,7 @@
@param {boolean} [options.displayReplyIcons]
@param {boolean} [options.displayStars]
@param {boolean} [options.displaySubjectsOnMessages]
+ @param {boolean} options.hasMessageAttachmentDeletable
@param {string|integer} [options.messagesSeparatorPosition] 'top' or
message ID, the separator is placed just after this message.
@param {integer} [options.selectedMessageID]
@@ -354,12 +355,16 @@
<t t-if="message.hasAttachments()">
<div t-if="message.hasImageAttachments()" class="o_attachments_previews">
<t t-foreach="message.getImageAttachments()" t-as="attachment">
- <t t-call="mail.AttachmentPreview"/>
+ <t t-call="mail.AttachmentPreview">
+ <t t-set="isDeletable" t-value="options.hasMessageAttachmentDeletable"/>
+ </t>
</t>
</div>
<div t-if="message.hasNonImageAttachments()" class="o_attachments_list">
<t t-foreach="message.getNonImageAttachments()" t-as="attachment">
- <t t-call="mail.Attachment"/>
+ <t t-call="mail.Attachment">
+ <t t-set="isDeletable" t-value="options.hasMessageAttachmentDeletable"/>
+ </t>
</t>
</div>
</t>
@@ -526,6 +531,7 @@
@param {integer} attachment.id
@param {string} attachment.name
@param {string} attachment.url
+ @param {boolean} [isDeletable=false]
-->
<t t-name="mail.AttachmentPreview">
<div class="o_attachment" t-att-title="attachment.name">
@@ -533,7 +539,7 @@
<div class="o_image_box">
<div class="o_attachment_image" t-attf-style="background-image:url('/web/image/#{attachment.id}/160x160/?crop=true')"/>
<div t-attf-class="o_image_overlay o_attachment_view" t-att-data-id="attachment.id">
- <span class="fa fa-times o_attachment_delete_cross" t-att-title="'Delete ' + attachment.name" t-att-data-id="attachment.id" t-att-data-name="attachment.name"/>
+ <span t-if="isDeletable" class="fa fa-times o_attachment_delete_cross" t-att-title="'Delete ' + attachment.name" t-att-data-id="attachment.id" t-att-data-name="attachment.name"/>
<span class="o_attachment_title text-white"><t t-esc="attachment.name"/></span>
<a class="o_attachment_download" t-att-href='attachment.url'>
<i t-attf-class="fa fa-download text-white" t-att-title="'Download ' + attachment.name" role="img" aria-label="Download"></i>
@@ -552,12 +558,15 @@
@param {string} attachment.name
@param {boolean} attachment.upload
@param {string} attachment.url
+ @param {boolean} [editable=false] if set, it means the attachment is rendered in the composer.
+ Some changes are required in that case, such as "delete" button is not visible (pretty unlink is used instead).
+ @param {boolean} [isDeletable=false]
-->
<t t-name="mail.Attachment">
<t t-set="type" t-value="attachment.mimetype and attachment.mimetype.split('/').shift()"/>
<div t-attf-class="o_attachment #{ editable ? 'o_attachment_editable' : '' } #{attachment.upload ? 'o_attachment_uploading' : ''}" t-att-title="attachment.name">
<div class="o_attachment_wrap">
- <span t-if="!editable" class="fa fa-times o_attachment_delete_cross" t-att-title="'Delete ' + attachment.name" t-att-data-id="attachment.id" t-att-data-name="attachment.name"/>
+ <span t-if="!editable and isDeletable" class="fa fa-times o_attachment_delete_cross" t-att-title="'Delete ' + attachment.name" t-att-data-id="attachment.id" t-att-data-name="attachment.name"/>
<t t-set="has_preview" t-value="type == 'image' or type == 'video' or attachment.mimetype == 'application/pdf'"/>
<t t-set="ext" t-value="attachment.filename.split('.').pop()"/>