Browse Source

🌈 pre-commit

pull/327/head
Denis Mudarisov 4 years ago
parent
commit
b7f692df19
No known key found for this signature in database GPG Key ID: B9AD74DAFB7B53DA
  1. 72
      mail_all/static/src/js/mail_all.js
  2. 7
      mail_all/static/src/xml/menu.xml

72
mail_all/static/src/js/mail_all.js

@ -1,7 +1,7 @@
/* Copyright 2020 Denis Mudarisov <https://github.com/trojikman>
License MIT (https://opensource.org/licenses/MIT). */
odoo.define("mail_all.all", function(require) {
odoo.define("mail_all.all", function (require) {
"use strict";
var chat_manager = require("mail_base.base").chat_manager;
@ -11,7 +11,7 @@ odoo.define("mail_all.all", function(require) {
var ChatAction = core.action_registry.get("mail.chat.instant_messaging");
ChatAction.include({
get_thread_rendering_options: function(messages) {
get_thread_rendering_options: function (messages) {
var options = this._super.apply(this, arguments);
options.display_subject =
options.display_subject || this.channel.id === "channel_all";
@ -19,42 +19,40 @@ odoo.define("mail_all.all", function(require) {
},
});
chat_manager.is_ready = chat_manager.is_ready.then(function () {
// Override methods
var chat_manager_super = _.clone(chat_manager);
chat_manager.get_properties = function(msg) {
var properties = chat_manager_super.get_properties.apply(this, arguments);
properties.is_all = this.property_descr("channel_all", msg, this);
return properties;
};
chat_manager.set_channel_flags = function(data, msg) {
chat_manager_super.set_channel_flags.apply(this, arguments);
msg.is_all = data.author_id !== "ODOOBOT";
return msg;
};
chat_manager.get_channel_array = function(msg) {
var arr = chat_manager_super.get_channel_array.apply(this, arguments);
return arr.concat("channel_all");
};
chat_manager.get_domain = function(channel) {
return channel.id === "channel_all"
? []
: chat_manager_super.get_domain.apply(this, arguments);
};
// Add all channel
chat_manager.add_channel({
id: "channel_all",
name: _lt("All messages"),
type: "static",
});
return $.when();
// Override methods
var chat_manager_super = _.clone(chat_manager);
chat_manager.get_properties = function (msg) {
var properties = chat_manager_super.get_properties.apply(this, arguments);
properties.is_all = this.property_descr("channel_all", msg, this);
return properties;
};
chat_manager.set_channel_flags = function (data, msg) {
chat_manager_super.set_channel_flags.apply(this, arguments);
msg.is_all = data.author_id !== "ODOOBOT";
return msg;
};
chat_manager.get_channel_array = function (msg) {
var arr = chat_manager_super.get_channel_array.apply(this, arguments);
return arr.concat("channel_all");
};
chat_manager.get_domain = function (channel) {
return channel.id === "channel_all"
? []
: chat_manager_super.get_domain.apply(this, arguments);
};
// Add all channel
chat_manager.add_channel({
id: "channel_all",
name: _lt("All messages"),
type: "static",
});
return $.when();
});
return chat_manager;

7
mail_all/static/src/xml/menu.xml

@ -7,9 +7,10 @@
t-attf-class="o_mail_chat_title_main o_mail_chat_channel_item #{(active_channel_id == 'channel_all') ? 'o_active': ''}"
data-channel-id="channel_all"
>
<span class="o_channel_name mail_all"> <i
class="fa fa-database"
/> All messages </span>
<span class="o_channel_name mail_all">
<i class="fa fa-database" />
All messages
</span>
</div>
</t>
</t>

Loading…
Cancel
Save