[IMP] mail,im_livechat: client action sidebar: 'unsubcribe' cross
displayed for all channels
This commit is contained in:
committed by
Géry Debongnie
parent
6b2250b2d2
commit
2dfbaceaec
@@ -4,13 +4,11 @@
|
||||
<t t-extend="mail.chat.Sidebar">
|
||||
<t t-jquery=".o_mail_chat_sidebar" t-operation="append">
|
||||
<t t-set="channel_type">livechat</t>
|
||||
<t t-set="disable_add_channel">true</t>
|
||||
<t t-call="mail.chat.SidebarTitle">
|
||||
<t t-set="channel_title">Livechat</t>
|
||||
<t t-set="disable_add_channel">true</t>
|
||||
</t>
|
||||
<t t-call="mail.chat.SidebarItems">
|
||||
<t t-set="display_close_button">true</t>
|
||||
</t>
|
||||
<t t-call="mail.chat.SidebarItems"/>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -106,14 +106,8 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
},
|
||||
"click .o_mail_partner_unpin": function (event) {
|
||||
event.stopPropagation();
|
||||
var self = this;
|
||||
var channel_id = $(event.target).data("channel-id");
|
||||
chat_manager
|
||||
.unsubscribe(chat_manager.get_channel(channel_id))
|
||||
.then(function () {
|
||||
self.render_sidebar();
|
||||
self.set_channel(chat_manager.get_channel("channel_inbox"));
|
||||
});
|
||||
this.unsubscribe_from_channel(chat_manager.get_channel(channel_id));
|
||||
},
|
||||
},
|
||||
|
||||
@@ -326,6 +320,19 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
});
|
||||
});
|
||||
},
|
||||
unsubscribe_from_channel: function (channel) {
|
||||
var self = this;
|
||||
chat_manager
|
||||
.unsubscribe(channel)
|
||||
.then(this.render_sidebar.bind(this))
|
||||
.then(this.set_channel.bind(this, chat_manager.get_channel("channel_inbox")))
|
||||
.then(function () {
|
||||
if (_.contains(['public', 'private'], channel.type)) {
|
||||
var msg = _.str.sprintf(_t('You unsubscribed from <b>%s</b>.'), channel.name);
|
||||
self.do_notify(_t("Unsubscribed"), msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
get_thread_rendering_options: function () {
|
||||
return {
|
||||
@@ -459,16 +466,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
},
|
||||
|
||||
on_click_button_unsubscribe: function () {
|
||||
var self = this;
|
||||
var channel = this.channel;
|
||||
chat_manager
|
||||
.unsubscribe(channel)
|
||||
.then(this.set_channel.bind(this, chat_manager.get_channel("channel_inbox")))
|
||||
.then(this.render_sidebar.bind(this))
|
||||
.then(function () {
|
||||
var msg = _.str.sprintf(_t('You unsubscribed from <b>%s</b>.'), channel.name);
|
||||
self.do_notify(_t("Unsubscribed"), msg);
|
||||
});
|
||||
this.unsubscribe_from_channel(this.channel);
|
||||
},
|
||||
on_click_button_settings: function() {
|
||||
this.do_action({
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
</t>
|
||||
<t t-call="mail.chat.SidebarItems">
|
||||
<t t-set="display_status">true</t>
|
||||
<t t-set="display_close_button">true</t>
|
||||
<t t-set="input_placeholder">Open chat</t>
|
||||
</t>
|
||||
|
||||
@@ -61,7 +60,7 @@
|
||||
<div t-if="channel.type === channel_type" class="o_mail_chat_channel_item" t-att-data-channel-id="channel.id">
|
||||
<span><i t-if="display_status" t-att-class="'o_user_status fa ' + (channel.status == 'online' ? 'fa-circle' : 'fa-circle-o')"/></span>
|
||||
<t t-esc="channel.name"/>
|
||||
<span t-if="display_close_button" class="fa fa-times pull-right o_mail_partner_unpin" t-att-title="_t('Close')" t-att-data-channel-id="channel.id"/>
|
||||
<span class="fa fa-times pull-right o_mail_partner_unpin" t-att-title="_t('Close')" t-att-data-channel-id="channel.id"/>
|
||||
</div>
|
||||
</t>
|
||||
<div t-if="!disable_add_channel" class="o_mail_add_channel" t-attf-data-type="#{channel_type}">
|
||||
|
||||
Reference in New Issue
Block a user