Browse Source

🌈 pre-commit

pull/324/head
Denis Mudarisov 4 years ago
parent
commit
85e5070064
No known key found for this signature in database GPG Key ID: B9AD74DAFB7B53DA
  1. 2
      mail_to/doc/changelog.rst
  2. 51
      mail_to/static/src/js/mail_to.js
  3. 2
      mail_to/static/src/js/test_mail_to.js
  4. 24
      mail_to/static/src/xml/recipient.xml

2
mail_to/doc/changelog.rst

@ -1,7 +1,7 @@
`1.1.2`
-------
- **Fix** if open the pop-up chat window and reload the page, then an error might occur randomly
- **Fix:** if open the pop-up chat window and reload the page, then an error might occur randomly
`1.1.1`
-------

51
mail_to/static/src/js/mail_to.js

@ -4,40 +4,39 @@
* Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
* Copyright 2020 Denis Mudarisov <https://github.com/trojikman>
* License MIT (https://opensource.org/licenses/MIT). */
odoo.define("mail_to.MailTo", function(require) {
odoo.define("mail_to.MailTo", function (require) {
"use strict";
var chat_manager = require("mail_base.base").chat_manager;
chat_manager.is_ready = chat_manager.is_ready.then(function(){
var make_message_super = chat_manager.make_message;
chat_manager.make_message = function(data) {
var msg = make_message_super.call(this, data);
msg.partner_ids = data.partner_ids;
msg.channel_names = data.channel_names;
msg.recipients = (data.partner_ids || []).concat(data.channel_names);
if (!msg.partner_ids && !msg.channel_names) {
return msg;
}
chat_manager.is_ready = chat_manager.is_ready.then(function () {
var make_message_super = chat_manager.make_message;
chat_manager.make_message = function (data) {
var msg = make_message_super.call(this, data);
msg.partner_ids = data.partner_ids;
msg.channel_names = data.channel_names;
msg.recipients = (data.partner_ids || []).concat(data.channel_names);
if (!msg.partner_ids && !msg.channel_names) {
return msg;
}
var more_recipients = "";
// Value which define more recipients
msg.more_recipients_value = 4;
for (var i = 0; i < msg.recipients.length; i++) {
if (i >= msg.more_recipients_value) {
// Append names
more_recipients += msg.recipients[i][1];
// Separate them with semicolon
if (i < msg.recipients.length - 1) {
more_recipients += "; ";
var more_recipients = "";
// Value which define more recipients
msg.more_recipients_value = 4;
for (var i = 0; i < msg.recipients.length; i++) {
if (i >= msg.more_recipients_value) {
// Append names
more_recipients += msg.recipients[i][1];
// Separate them with semicolon
if (i < msg.recipients.length - 1) {
more_recipients += "; ";
}
}
}
}
msg.more_recipients = more_recipients;
return msg;
};
msg.more_recipients = more_recipients;
return msg;
};
});
return chat_manager;

2
mail_to/static/src/js/test_mail_to.js

@ -1,6 +1,6 @@
/* Copyright 2018 Artem Rafailov <https://it-projects.info/team/KolushovAlexandr>
License MIT (https://opensource.org/licenses/MIT).*/
odoo.define("mail_to.tour", function(require) {
odoo.define("mail_to.tour", function (require) {
"use strict";
var tour = require("web_tour.tour");

24
mail_to/static/src/xml/recipient.xml

@ -8,8 +8,8 @@
<t t-jquery="p[class=o_mail_info] span:last" t-operation="after">
<span class="recipients_info">
<t t-if="message.partner_ids">
<t t-if="message.partner_ids.length > 0">To: </t>
<t t-else="message.channel_ids.length > 0">To: </t>
<t t-if="message.partner_ids.length > 0">To:</t>
<t t-else="message.channel_ids.length > 0">To:</t>
<t t-foreach="message.partner_ids.length" t-as="i">
<t t-if="i &lt; message.more_recipients_value">
<a
@ -17,10 +17,12 @@
class="recipient_link"
>
<i t-esc="message.partner_ids[i][1]" />
<t t-if="i &lt; message.partner_ids.length - 1">; </t>
<t t-if="i &lt; message.partner_ids.length - 1">;</t>
<t
t-else="message.channel_ids.length > 0 and message.partner_ids.length &lt; 4"
>; </t>
>
;
</t>
</a>
</t>
</t>
@ -35,9 +37,9 @@
class="recipient_link"
>
<i t-esc="message.channel_names[i][1]" />
<t
t-if="i &lt; message.channel_ids.length - 1"
>; </t>
<t t-if="i &lt; message.channel_ids.length - 1">
;
</t>
</a>
</t>
</t>
@ -46,10 +48,12 @@
t-if="message.recipients.length &gt; message.more_recipients_value"
>
<span t-att-title="message.more_recipients">
and <t
and
<t
t-esc="message.recipients.length - message.more_recipients_value"
/> more
</span>
/>
more
</span>
</t>
</t>
</span>

Loading…
Cancel
Save