[IMP] im_livechat: legacy: remove obsolete seen code

task-2825192

closes odoo/odoo#88904

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Sébastien Theys
2022-04-15 16:45:48 +02:00
parent 294a9b7a7a
commit 9a21cb48e4
4 changed files with 0 additions and 172 deletions
@@ -103,16 +103,6 @@ var AbstractThread = Class.extend(Mixins.EventDispatcherMixin, {
hasMessages: function () {
return !_.isEmpty(this.getMessages());
},
/**
* States whether this thread is compatible with the 'seen' feature.
* By default, threads do not have thsi feature active.
* @see {im_livechat.legacy.mail.model.ThreadSeenMixin} to enable this feature on a thread.
*
* @returns {boolean}
*/
hasSeenFeature: function () {
return false;
},
/**
* States whether this thread is folded or not.
*
@@ -322,10 +322,6 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default;
.o_thread_message_side_date {
opacity: 0;
}
.o_mail_thread_message_seen_icon:not(.o_all_seen) {
opacity: $o-mail-thread-icon-opacity*0.5;
}
}
.o_thread_icon {
cursor: pointer;
@@ -348,11 +344,6 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default;
opacity: 1;
}
}
.o_thread_message_sidebar {
.o_mail_thread_message_seen_icon {
display: none;
}
}
}
.o_mail_redirect {
@@ -510,34 +501,6 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default;
}
}
// ------------------------------------------------------------------
// Thread seen icon: shared between discuss and chat windows
// ------------------------------------------------------------------
.o_mail_thread_message_seen_icon {
position: relative;
opacity: 0.6;
&.o_all_seen {
color: $o-enterprise-color;
}
&:hover {
cursor: pointer;
opacity: 0.8;
}
.fa-check:nth-child(1) {
padding-left: 3px;
}
.fa-check:nth-child(2) {
position: absolute;
top: -1px;
left: 0px;
}
}
//-------------------------------------
// legacy: im_livechat/im_livechat.scss
//-------------------------------------
@@ -354,7 +354,6 @@
<i t-if="!displayAuthorMessages[message.getID()] and options.displayStars and message.getType() !== 'notification'"
t-att-class="'fa o_thread_message_star o_thread_icon ' + (message.isStarred() ? 'fa-star' : 'fa-star-o')"
t-att-data-message-id="message.getID()" title="Mark as Todo" role="img" aria-label="Mark as todo"/>
<t t-if="!displayAuthorMessages[message.getID()] and thread.hasSeenFeature()" t-call="im_livechat.legacy.mail.widget.Thread.Message.SeenIcon"/>
</div>
<div class="o_thread_message_core">
<p t-if="displayAuthorMessages[message.getID()]" class="o_mail_info text-muted">
@@ -390,7 +389,6 @@
</span>
</span>
<span t-attf-class="o_thread_icons">
<t t-if="thread.hasSeenFeature()" t-call="im_livechat.legacy.mail.widget.Thread.Message.SeenIcon"/>
<i t-if="message.isLinkedToDocumentThread() and options.displayReplyIcons"
class="fa fa-reply o_thread_icon o_thread_message_reply"
t-att-data-message-id="message.getID()" title="Reply" role="img" aria-label="Reply"/>
@@ -431,70 +429,6 @@
</t>
</t>
<!--
Display the seen icon of a message in the thread.
It shows the fetch 'check' before the seen 'check'. We change the order in the template
so that fetch 'check' is on top of 'seen' check (z-index does not work with absolute positioning)
@param {mail.model.Thread} thread
@param {mail.model.Message} message
-->
<t t-name="im_livechat.legacy.mail.widget.Thread.Message.SeenIcon">
<t t-if="message.isMyselfAuthor() and message.getID() >= thread.getLastMessageIDSeenByEveryone()">
<span t-attf-class="o_mail_thread_message_seen_icon #{thread.hasEveryoneSeen(message) ? 'o_all_seen' : ''}" t-att-data-message-id="message.getID()">
<t t-if="thread.hasSomeoneFetched(message)">
<i class="fa fa-check"/>
</t>
<t t-if="thread.hasSomeoneSeen(message)">
<i class="fa fa-check"/>
</t>
</span>
</t>
</t>
<!--
Display the popover content when clicking the seen icion of a message in the thread.
List the members that have received the messages, and the members that have seen it.
@param {mail.model.Thread} thread
@param {mail.model.Message} message
-->
<t t-name="im_livechat.legacy.mail.widget.Thread.Message.SeenIconPopoverContent">
<div class="o_mail_thread_message_seen_icon_content">
<t t-if="thread.hasEveryoneSeen(message)">
<p>Seen by Everyone</p>
</t>
<t t-else="">
<t t-if="thread.hasSomeoneSeen(message)">
<t t-set="seen_members" t-value="thread.getSeenMembers(message)"/>
Seen by:
<ul>
<li t-foreach="seen_members" t-as="member">
<t t-esc="member.name"/> (<t t-esc="member.email"/>)
</li>
</ul>
</t>
<t t-if="thread.hasSomeoneFetched(message)">
<t t-if="thread.hasEveryoneFetched(message)">
<p>Received by Everyone</p>
</t>
<t t-else="">
<t t-set="fetched_members" t-value="thread.getFetchedNotSeenMembers(message)"/>
<t t-if="!_.isEmpty(fetched_members)">
Received by:
<ul>
<li t-foreach="fetched_members" t-as="member">
<t t-esc="member.name"/> (<t t-esc="member.email"/>)
</li>
</ul>
</t>
</t>
</t>
</t>
</div>
</t>
<!--
@param {Object[]} notifications: list of notifications
A notification is an object with at least the following keys:
@@ -86,9 +86,6 @@ var ThreadWidget = Widget.extend({
this._selectedMessageID = null;
this._currentThreadID = null;
this._messageMailPopover = null;
this._messageSeenPopover = null;
// used to track popover IDs to destroy on re-rendering of popovers
this._openedSeenPopoverIDs = [];
},
/**
* The message mail popover may still be shown at this moment. If we do not
@@ -101,10 +98,6 @@ var ThreadWidget = Widget.extend({
if (this._messageMailPopover) {
this._messageMailPopover.popover('hide');
}
if (this._messageSeenPopover) {
this._messageSeenPopover.popover('hide');
}
this._destroyOpenSeenPopoverIDs();
this._super();
},
/**
@@ -214,9 +207,6 @@ var ThreadWidget = Widget.extend({
}
this._renderMessageNotificationPopover(messages);
if (thread.hasSeenFeature()) {
this._renderMessageSeenPopover(thread, messages);
}
},
/**
@@ -334,15 +324,6 @@ var ThreadWidget = Widget.extend({
// Private
//--------------------------------------------------------------------------
/**
* @private
*/
_destroyOpenSeenPopoverIDs: function () {
_.each(this._openedSeenPopoverIDs, function (popoverID) {
$('#' + popoverID).remove();
});
this._openedSeenPopoverIDs = [];
},
/**
* Modifies $element to add the 'read more/read less' functionality
* All element nodes with 'data-o-mail-quote' attribute are concerned.
@@ -485,46 +466,6 @@ var ThreadWidget = Widget.extend({
},
});
},
/**
* Render the popover when mouse hovering on the seen icon of a message
* in the thread. Only seen icons in non-squashed message have popover,
* because squashed messages hides this icon on message mouseover.
*
* @private
* @param {im_livechat.legacy.mail.model.AbstractThread} thread with thread seen mixin,
* @see {im_livechat.legacy.mail.model.ThreadSeenMixin}
* @param {im_livechat.legacy.mail.model.Message[]} messages list of messages in the
* rendered thread.
*/
_renderMessageSeenPopover: function (thread, messages) {
var self = this;
this._destroyOpenSeenPopoverIDs();
if (this._messageSeenPopover) {
this._messageSeenPopover.popover('hide');
}
if (!this.$('.o_thread_message_core .o_mail_thread_message_seen_icon').length) {
return;
}
this._messageSeenPopover = this.$('.o_thread_message_core .o_mail_thread_message_seen_icon').popover({
html: true,
boundary: 'viewport',
placement: 'auto',
trigger: 'hover',
offset: '0, 1',
content: function () {
var $this = $(this);
self._openedSeenPopoverIDs.push($this.attr('aria-describedby'));
var messageID = $this.data('message-id');
var message = _.find(messages, function (message) {
return message.getID() === messageID;
});
return QWeb.render('im_livechat.legacy.mail.widget.Thread.Message.SeenIconPopoverContent', {
thread: thread,
message: message,
});
},
});
},
/**
* @private
*/