From 78b275f54db6efb4b1826604e9be3b3c1dfd5eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 4 May 2023 11:01:27 +0000 Subject: [PATCH] [REF] mail: simplify message template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify template so there are less code duplication between editing state and non-editing state. Also fixes following small style issues: - missing opacity-25 when editing message of others - expanded options of message come on top of jump present alert closes odoo/odoo#120550 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/core/message_model.js | 4 -- addons/mail/static/src/core_ui/message.js | 8 ++- addons/mail/static/src/core_ui/message.xml | 61 ++++++++----------- .../static/src/core_ui/message_reactions.xml | 4 +- addons/mail/static/src/core_ui/thread.scss | 2 +- addons/mail/static/src/web/message_patch.xml | 2 +- 6 files changed, 35 insertions(+), 46 deletions(-) diff --git a/addons/mail/static/src/core/message_model.js b/addons/mail/static/src/core/message_model.js index 287db295303..8183f873e20 100644 --- a/addons/mail/static/src/core/message_model.js +++ b/addons/mail/static/src/core/message_model.js @@ -118,10 +118,6 @@ export class Message { return this.datetime.toLocaleString(DateTime.DATETIME_SHORT); } - get isAutomatedMessage() { - return this.type === "auto_comment"; - } - get isSelfMentioned() { return this.recipients.some((recipient) => recipient === this._store.self); } diff --git a/addons/mail/static/src/core_ui/message.js b/addons/mail/static/src/core_ui/message.js index fe360529f6b..82d82a87828 100644 --- a/addons/mail/static/src/core_ui/message.js +++ b/addons/mail/static/src/core_ui/message.js @@ -459,8 +459,12 @@ export class Message extends Component { this.state.isEditing = false; } - onClickNotificationIcon(ev) { - this.popover.open(ev.target, { message: this.message }); + onClickNotification(ev) { + if (this.message.failureNotifications.length > 0) { + this.onClickFailure(ev); + } else { + this.popover.open(ev.target, { message: this.message }); + } } onClickFailure(ev) { diff --git a/addons/mail/static/src/core_ui/message.xml b/addons/mail/static/src/core_ui/message.xml index a81d71b6644..effc93503bd 100644 --- a/addons/mail/static/src/core_ui/message.xml +++ b/addons/mail/static/src/core_ui/message.xml @@ -73,76 +73,65 @@
- - - - +
-
-
+
- + +
+ 'border': state.isEditing, + 'bg-info-light border border-info opacity-25': !message.isSelfAuthored and !message.isNote, + 'bg-success-light border border-success opacity-25': message.isSelfAuthored and !message.isNote, + }" t-attf-class="{{ isAlignedRight ? 'rounded-start-3' : 'rounded-end-3' }}"/>
- Subject: - - (edited) - + + + Subject: + + (edited) + +
-
-
-
-
- -
-
-
diff --git a/addons/mail/static/src/core_ui/message_reactions.xml b/addons/mail/static/src/core_ui/message_reactions.xml index 261a09a3f83..924a72d4610 100644 --- a/addons/mail/static/src/core_ui/message_reactions.xml +++ b/addons/mail/static/src/core_ui/message_reactions.xml @@ -4,9 +4,9 @@
+ t-attf-class="{{ props.message.isDiscussion ? 'mt-n2' : 'mt-1' }}">