[IMP] mail: tracking_val changed display on systray
Display the content of the tracked changes that generate a notification under the systray task-2369610 closes odoo/odoo#86437 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
+8
-3
@@ -42,10 +42,15 @@
|
||||
</div>
|
||||
<div class="o_ThreadNeedactionPreview_core d-flex align-items-baseline">
|
||||
<span class="o_NotificationListItem_coreItem o_NotificationListItem_inlineText o_ThreadNeedactionPreview_coreItem o_ThreadNeedactionPreview_inlineText me-2 text-truncate" t-att-class="{ 'o-empty': threadNeedactionPreviewView.isEmpty }">
|
||||
<t t-if="threadNeedactionPreviewView.messageAuthorPrefixView">
|
||||
<MessageAuthorPrefix record="threadNeedactionPreviewView.messageAuthorPrefixView"/>
|
||||
<t t-if="threadNeedactionPreviewView.lastTrackingValue">
|
||||
<TrackingValue value="threadNeedactionPreviewView.lastTrackingValue"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t t-if="threadNeedactionPreviewView.messageAuthorPrefixView">
|
||||
<MessageAuthorPrefix record="threadNeedactionPreviewView.messageAuthorPrefixView"/>
|
||||
</t>
|
||||
<span class="o_ThreadNeedactionPreview_messageBody" t-esc="threadNeedactionPreviewView.inlineLastNeedactionMessageAsOriginThreadBody"/>
|
||||
</t>
|
||||
<span class="o_ThreadNeedactionPreview_messageBody" t-esc="threadNeedactionPreviewView.inlineLastNeedactionMessageAsOriginThreadBody"/>
|
||||
</span>
|
||||
<span class="flex-grow-1"/>
|
||||
<span class="o_NotificationListItem_coreItem o_NotificationListItem_markAsRead o_ThreadNeedactionPreview_coreItem o_ThreadNeedactionPreview_markAsRead fa fa-check d-flex flex-shrink-0 ms-2 text-600 opacity-50 opacity-100-hover" title="Mark as Read" t-on-click="threadNeedactionPreviewView.onClickMarkAsRead" t-ref="markAsRead"/>
|
||||
|
||||
@@ -46,10 +46,15 @@
|
||||
</div>
|
||||
<div class="o_ThreadPreview_core d-flex align-items-baseline">
|
||||
<span class="o_NotificationListItem_coreItem o_NotificationListItem_inlineText o_ThreadPreview_coreItem o_ThreadPreview_inlineText me-2 text-truncate" t-att-class="{ 'o-empty': threadPreviewView.isEmpty }">
|
||||
<t t-if="threadPreviewView.messageAuthorPrefixView">
|
||||
<MessageAuthorPrefix record="threadPreviewView.messageAuthorPrefixView"/>
|
||||
<t t-if="threadPreviewView.lastTrackingValue">
|
||||
<TrackingValue value="threadPreviewView.lastTrackingValue"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t t-if="threadPreviewView.messageAuthorPrefixView">
|
||||
<MessageAuthorPrefix record="threadPreviewView.messageAuthorPrefixView"/>
|
||||
</t>
|
||||
<span class="o_ThreadPreview_messageBody" t-esc="threadPreviewView.inlineLastMessageBody"/>
|
||||
</t>
|
||||
<span class="o_ThreadPreview_messageBody" t-esc="threadPreviewView.inlineLastMessageBody"/>
|
||||
</span>
|
||||
<span class="flex-grow-1"/>
|
||||
<t t-if="threadPreviewView.thread.localMessageUnreadCounter > 0">
|
||||
|
||||
@@ -523,6 +523,20 @@ registerModel({
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeLastTrackingValue() {
|
||||
const {
|
||||
length: l,
|
||||
[l - 1]: lastTrackingValue,
|
||||
} = this.trackingValues;
|
||||
if (lastTrackingValue) {
|
||||
return replace(lastTrackingValue);
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
/**
|
||||
* This value is meant to be based on field body which is
|
||||
* returned by the server (and has been sanitized before stored into db).
|
||||
@@ -597,6 +611,11 @@ registerModel({
|
||||
}
|
||||
return replace(threads);
|
||||
},
|
||||
_sortTrackingValues() {
|
||||
return [
|
||||
['smaller-first', 'id'],
|
||||
];
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
authorName: attr({
|
||||
@@ -778,6 +797,12 @@ registerModel({
|
||||
isStarred: attr({
|
||||
default: false,
|
||||
}),
|
||||
/**
|
||||
* Last tracking value of the message.
|
||||
*/
|
||||
lastTrackingValue: one('TrackingValue', {
|
||||
compute: '_computeLastTrackingValue',
|
||||
}),
|
||||
/**
|
||||
* Groups of reactions per content allowing to know the number of
|
||||
* reactions for each.
|
||||
@@ -841,6 +866,7 @@ registerModel({
|
||||
trackingValues: many('TrackingValue', {
|
||||
inverse: 'messageOwner',
|
||||
isCausal: true,
|
||||
sort: '_sortTrackingValues',
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear, insertAndReplace, replace } from '@mail/model/model_field_command';
|
||||
import { htmlToTextContentInline } from '@mail/js/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -50,7 +50,17 @@ registerModel({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_computeIsEmpty() {
|
||||
return !this.inlineLastNeedactionMessageAsOriginThreadBody;
|
||||
return !this.inlineLastNeedactionMessageAsOriginThreadBody && !this.lastTrackingValue;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeLastTrackingValue() {
|
||||
if (this.thread.lastMessage && this.thread.lastMessage.lastTrackingValue) {
|
||||
return replace(this.thread.lastMessage.lastTrackingValue);
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -76,6 +86,10 @@ registerModel({
|
||||
compute: '_computeIsEmpty',
|
||||
readonly: true,
|
||||
}),
|
||||
lastTrackingValue: one('TrackingValue', {
|
||||
compute:'_computeLastTrackingValue',
|
||||
readonly: true,
|
||||
}),
|
||||
/**
|
||||
* Reference of the "mark as read" button. Useful to disable the
|
||||
* top-level click handler when clicking on this specific button.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear, insertAndReplace, replace } from '@mail/model/model_field_command';
|
||||
import { htmlToTextContentInline } from '@mail/js/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -49,7 +49,17 @@ registerModel({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_computeIsEmpty() {
|
||||
return !this.inlineLastMessageBody;
|
||||
return !this.inlineLastMessageBody && !this.lastTrackingValue;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeLastTrackingValue() {
|
||||
if (this.thread.lastMessage && this.thread.lastMessage.lastTrackingValue) {
|
||||
return replace(this.thread.lastMessage.lastTrackingValue);
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -75,6 +85,10 @@ registerModel({
|
||||
compute: '_computeIsEmpty',
|
||||
readonly: true,
|
||||
}),
|
||||
lastTrackingValue: one('TrackingValue', {
|
||||
compute:'_computeLastTrackingValue',
|
||||
readonly: true,
|
||||
}),
|
||||
/**
|
||||
* Reference of the "mark as read" button. Useful to disable the
|
||||
* top-level click handler when clicking on this specific button.
|
||||
|
||||
Reference in New Issue
Block a user