odoo-addon-mail-gateway 17.0.1.0.0.2__py3-none-any.whl → 18.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of odoo-addon-mail-gateway might be problematic. Click here for more details.

Files changed (59) hide show
  1. odoo/addons/mail_gateway/README.rst +16 -6
  2. odoo/addons/mail_gateway/__init__.py +1 -0
  3. odoo/addons/mail_gateway/__manifest__.py +2 -1
  4. odoo/addons/mail_gateway/controllers/__init__.py +0 -1
  5. odoo/addons/mail_gateway/controllers/gateway.py +2 -2
  6. odoo/addons/mail_gateway/i18n/mail_gateway.pot +6 -52
  7. odoo/addons/mail_gateway/models/discuss_channel.py +24 -18
  8. odoo/addons/mail_gateway/models/mail_gateway.py +4 -4
  9. odoo/addons/mail_gateway/models/mail_gateway_abstract.py +1 -1
  10. odoo/addons/mail_gateway/models/mail_guest.py +6 -4
  11. odoo/addons/mail_gateway/models/mail_message.py +32 -14
  12. odoo/addons/mail_gateway/models/mail_notification.py +13 -6
  13. odoo/addons/mail_gateway/models/mail_thread.py +26 -12
  14. odoo/addons/mail_gateway/models/res_partner.py +0 -14
  15. odoo/addons/mail_gateway/models/res_users.py +3 -3
  16. odoo/addons/mail_gateway/readme/CONTRIBUTORS.md +3 -0
  17. odoo/addons/mail_gateway/readme/ROADMAP.md +1 -0
  18. odoo/addons/mail_gateway/security/security.xml +0 -1
  19. odoo/addons/mail_gateway/static/description/index.html +27 -16
  20. odoo/addons/mail_gateway/static/src/components/chatter/chatter.esm.js +2 -3
  21. odoo/addons/mail_gateway/static/src/components/chatter/chatter.xml +9 -3
  22. odoo/addons/mail_gateway/static/src/components/composer/composer.esm.js +3 -4
  23. odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.esm.js +0 -1
  24. odoo/addons/mail_gateway/static/src/components/message/message.xml +3 -3
  25. odoo/addons/mail_gateway/static/src/components/message/message_patch.esm.js +7 -7
  26. odoo/addons/mail_gateway/static/src/core/common/composer_model_patch.esm.js +0 -1
  27. odoo/addons/mail_gateway/static/src/core/common/discuss_app_model_patch.esm.js +15 -21
  28. odoo/addons/mail_gateway/static/src/core/common/mail_composer_send_dropdown.esm.js +27 -0
  29. odoo/addons/mail_gateway/static/src/core/common/mail_composer_send_dropdown.xml +15 -0
  30. odoo/addons/mail_gateway/static/src/core/common/message_actions.esm.js +22 -20
  31. odoo/addons/mail_gateway/static/src/core/common/message_model_patch.esm.js +12 -8
  32. odoo/addons/mail_gateway/static/src/core/common/notification_model_patch.esm.js +0 -1
  33. odoo/addons/mail_gateway/static/src/core/common/persona_model_patch.esm.js +1 -3
  34. odoo/addons/mail_gateway/static/src/core/common/store_service_patch.esm.js +14 -10
  35. odoo/addons/mail_gateway/static/src/core/common/thread_model_patch.esm.js +14 -9
  36. odoo/addons/mail_gateway/static/src/core/web/discuss_app_category_model_patch.esm.js +2 -4
  37. odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_category_item_patch.xml +7 -3
  38. odoo/addons/mail_gateway/static/src/core/web/gateway_core_web_service.esm.js +13 -17
  39. odoo/addons/mail_gateway/static/src/models/gateway.esm.js +3 -4
  40. odoo/addons/mail_gateway/static/src/models/gateway_channel.esm.js +2 -3
  41. odoo/addons/mail_gateway/static/src/models/gateway_follower.esm.js +2 -3
  42. odoo/addons/mail_gateway/tools/__init__.py +1 -0
  43. odoo/addons/mail_gateway/tools/discuss.py +16 -0
  44. odoo/addons/mail_gateway/views/mail_gateway.xml +3 -3
  45. odoo/addons/mail_gateway/views/res_partner_gateway_channel.xml +3 -4
  46. odoo/addons/mail_gateway/views/res_users_settings_views.xml +12 -0
  47. odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.xml +1 -5
  48. odoo/addons/mail_gateway/wizards/mail_guest_manage.xml +0 -4
  49. odoo/addons/mail_gateway/wizards/mail_message_gateway_link.py +2 -4
  50. odoo/addons/mail_gateway/wizards/mail_message_gateway_link.xml +0 -2
  51. odoo/addons/mail_gateway/wizards/mail_message_gateway_send.xml +0 -4
  52. {odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/METADATA +19 -9
  53. odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info/RECORD +77 -0
  54. {odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/WHEEL +1 -1
  55. odoo/addons/mail_gateway/controllers/discuss.py +0 -11
  56. odoo/addons/mail_gateway/static/src/core/common/thread_service_patch.esm.js +0 -19
  57. odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_categories.esm.js +0 -16
  58. odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info/RECORD +0 -74
  59. {odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/top_level.txt +0 -0
@@ -372,9 +372,9 @@ ul.auto-toc {
372
372
  !! This file is generated by oca-gen-addon-readme !!
373
373
  !! changes will be overwritten. !!
374
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
- !! source digest: sha256:090c115a21a87266ff44c47592dc84c631afe5c2d4780e17abc731f918ae6c38
375
+ !! source digest: sha256:568a6781f64a53a5752bbccddcce93fffe6b683c77cb5717a30264cfab6068b9
376
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.0/mail_gateway"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_gateway"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/18.0/mail_gateway"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
378
  <p>This module will allow you to integrate an external chat system in your
379
379
  Odoo system. It requires extra modules with the specific configuration
380
380
  of each chat system, like mail_gateway_telegram or
@@ -386,12 +386,13 @@ chat system.</p>
386
386
  <div class="contents local topic" id="contents">
387
387
  <ul class="simple">
388
388
  <li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
389
- <li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
390
- <li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
391
- <li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
392
- <li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
393
- <li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
394
- <li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
389
+ <li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
390
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
391
+ <li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
392
+ <li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
393
+ <li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
394
+ <li><a class="reference internal" href="#other-credits" id="toc-entry-7">Other credits</a></li>
395
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
395
396
  </ul>
396
397
  </li>
397
398
  </ul>
@@ -409,37 +410,47 @@ the partner. To use this, we just need to use the</p>
409
410
  <p>It is recomended to enable chatter notification to all users that will
410
411
  receive messages from gateways.</p>
411
412
  </div>
413
+ <div class="section" id="known-issues-roadmap">
414
+ <h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
415
+ <ol class="arabic simple">
416
+ <li>Make possible to schedule gateway messages.</li>
417
+ </ol>
418
+ </div>
412
419
  <div class="section" id="bug-tracker">
413
- <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
420
+ <h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
414
421
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
415
422
  In case of trouble, please check there if your issue has already been reported.
416
423
  If you spotted it first, help us to smash it by providing a detailed and welcomed
417
- <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
424
+ <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
418
425
  <p>Do not contact contributors directly about support or help with technical issues.</p>
419
426
  </div>
420
427
  <div class="section" id="credits">
421
- <h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
428
+ <h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
422
429
  <div class="section" id="authors">
423
- <h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
430
+ <h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
424
431
  <ul class="simple">
425
432
  <li>Creu Blanca</li>
426
433
  <li>Dixmit</li>
427
434
  </ul>
428
435
  </div>
429
436
  <div class="section" id="contributors">
430
- <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
437
+ <h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
431
438
  <ul class="simple">
432
439
  <li>Enric Tobella</li>
433
440
  <li>Olga Marco</li>
441
+ <li><a class="reference external" href="https://tecnativa.com">Tecnativa</a><ul>
442
+ <li>Carlos Roca</li>
443
+ </ul>
444
+ </li>
434
445
  </ul>
435
446
  </div>
436
447
  <div class="section" id="other-credits">
437
- <h3><a class="toc-backref" href="#toc-entry-6">Other credits</a></h3>
448
+ <h3><a class="toc-backref" href="#toc-entry-7">Other credits</a></h3>
438
449
  <p>This work has been funded by AEOdoo (Asociación Española de Odoo -
439
450
  <a class="reference external" href="https://www.aeodoo.org">https://www.aeodoo.org</a>)</p>
440
451
  </div>
441
452
  <div class="section" id="maintainers">
442
- <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
453
+ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
443
454
  <p>This module is maintained by the OCA.</p>
444
455
  <a class="reference external image-reference" href="https://odoo-community.org">
445
456
  <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -447,7 +458,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
447
458
  <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
448
459
  mission is to support the collaborative development of Odoo features and
449
460
  promote its widespread use.</p>
450
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mail_gateway">OCA/social</a> project on GitHub.</p>
461
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/18.0/mail_gateway">OCA/social</a> project on GitHub.</p>
451
462
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
452
463
  </div>
453
464
  </div>
@@ -1,7 +1,6 @@
1
- /** @odoo-module **/
2
- import {Chatter} from "@mail/core/web/chatter";
3
- import {patch} from "@web/core/utils/patch";
1
+ import {Chatter} from "@mail/chatter/web_portal/chatter";
4
2
  import {GatewayFollower} from "../gateway_follower/gateway_follower.esm";
3
+ import {patch} from "@web/core/utils/patch";
5
4
 
6
5
  patch(Chatter, {
7
6
  components: {...Chatter.components, GatewayFollower},
@@ -22,7 +22,10 @@
22
22
  <span> Gateway message</span>
23
23
  </button>
24
24
  </xpath>
25
- <xpath expr="//SuggestedRecipientsList" position="before">
25
+ <xpath
26
+ expr="//t[@t-if='state.composerType']/SuggestedRecipientsList"
27
+ position="before"
28
+ >
26
29
  <t
27
30
  t-if="state.composerType === 'gateway' and state.thread.gateway_followers.length"
28
31
  >
@@ -45,10 +48,13 @@
45
48
  </t>
46
49
  <t t-set="type" t-value="type === 'gateway' ? 'gateway' : type" />
47
50
  </xpath>
48
- <xpath expr="//SuggestedRecipientsList" position="attributes">
51
+ <xpath
52
+ expr="//t[@t-if='state.composerType']/SuggestedRecipientsList"
53
+ position="attributes"
54
+ >
49
55
  <attribute
50
56
  name="t-if"
51
- >props.hasFollowers and state.composerType !== 'note' and state.composerType !== 'gateway'</attribute>
57
+ >state.composerType !== 'note' and state.thread.recipients.length > 0 and state.composerType !== 'gateway'</attribute>
52
58
  </xpath>
53
59
  </t>
54
60
  </templates>
@@ -1,7 +1,6 @@
1
- /** @odoo-module **/
2
- import {patch} from "@web/core/utils/patch";
3
1
  import {Composer} from "@mail/core/common/composer";
4
2
  import {_t} from "@web/core/l10n/translation";
3
+ import {patch} from "@web/core/utils/patch";
5
4
  import {prettifyMessageContent} from "@mail/utils/common/format";
6
5
 
7
6
  patch(Composer.prototype, {
@@ -26,7 +25,7 @@ patch(Composer.prototype, {
26
25
  if (this.props.type !== "gateway") {
27
26
  return isSendButtonDisabled;
28
27
  }
29
- return isSendButtonDisabled || !this.thread?.gateway_notifications.length;
28
+ return isSendButtonDisabled || !this.thread?.gateway_notifications?.length;
30
29
  },
31
30
  onFocusin() {
32
31
  super.onFocusin();
@@ -99,7 +98,7 @@ patch(Composer.prototype, {
99
98
  this.clear();
100
99
  this.props.messageToReplyTo?.cancel();
101
100
  if (this.thread) {
102
- this.threadService.fetchNewMessages(this.thread);
101
+ this.thread?.fetchNewMessages();
103
102
  }
104
103
  },
105
104
  };
@@ -1,4 +1,3 @@
1
- /** @odoo-module **/
2
1
  import {Component} from "@odoo/owl";
3
2
 
4
3
  export class GatewayFollower extends Component {
@@ -12,9 +12,9 @@
12
12
  class="ms-1 text-500"
13
13
  >
14
14
  <t t-if="message.gateway_thread_data.model !== 'discuss.channel'">
15
- on <a t-att-href="message.resUrl"><t
16
- t-esc="message.gateway_thread_data?.name"
17
- /></a>
15
+ on <a t-att-href="message.resUrl">
16
+ <t t-esc="message.gateway_thread_data?.name" />
17
+ </a>
18
18
  </t>
19
19
  </small>
20
20
  </xpath>
@@ -1,6 +1,5 @@
1
- /* @odoo-module */
2
- import {_t} from "@web/core/l10n/translation";
3
1
  import {Message} from "@mail/core/common/message";
2
+ import {_t} from "@web/core/l10n/translation";
4
3
  import {patch} from "@web/core/utils/patch";
5
4
 
6
5
  patch(Message.prototype, {
@@ -58,10 +57,11 @@ patch(Message.prototype, {
58
57
  });
59
58
  },
60
59
  openGatewayThreadRecord() {
61
- const gateway_thread = this.threadService.getThread(
62
- this.message.gateway_thread_data.model,
63
- this.message.gateway_thread_data.id
64
- );
65
- this.threadService.open(gateway_thread);
60
+ this.store.env.services.action.doAction({
61
+ type: "ir.actions.act_window",
62
+ res_id: this.message.gateway_thread_data.id,
63
+ res_model: this.message.gateway_thread_data.model,
64
+ views: [[false, "form"]],
65
+ });
66
66
  },
67
67
  });
@@ -1,4 +1,3 @@
1
- /* @odoo-module */
2
1
  import {Composer} from "@mail/core/common/composer_model";
3
2
  import {patch} from "@web/core/utils/patch";
4
3
  import {url} from "@web/core/utils/urls";
@@ -1,31 +1,25 @@
1
- /* @odoo-module */
2
-
3
- import {DiscussApp} from "@mail/core/common/discuss_app_model";
1
+ import {DiscussApp} from "@mail/core/public_web/discuss_app_model";
4
2
  import {Record} from "@mail/core/common/record";
5
3
 
6
4
  import {_t} from "@web/core/l10n/translation";
7
5
  import {patch} from "@web/core/utils/patch";
8
6
 
9
- patch(DiscussApp, {
10
- new(data) {
11
- const res = super.new(data);
12
- res.gateway = {
13
- extraClass: "o-mail-DiscussSidebarCategory-gateway",
14
- id: "gateway",
15
- name: _t("Gateway"),
16
- isOpen: false,
17
- canView: false,
18
- canAdd: true,
19
- addTitle: _t("Search Gateway Channel"),
20
- serverStateKey: "is_discuss_sidebar_category_gateway_open",
21
- };
22
- return res;
23
- },
24
- });
25
-
26
7
  patch(DiscussApp.prototype, {
27
8
  setup(env) {
28
9
  super.setup(env);
29
- this.gateway = Record.one("DiscussAppCategory");
10
+ this.gateway = Record.one("DiscussAppCategory", {
11
+ compute() {
12
+ return {
13
+ extraClass: "o-mail-DiscussSidebarCategory-gateway",
14
+ id: "gateway",
15
+ name: _t("Gateway"),
16
+ isOpen: false,
17
+ canView: false,
18
+ canAdd: true,
19
+ addTitle: _t("Search Gateway Channel"),
20
+ serverStateKey: "is_discuss_sidebar_category_gateway_open",
21
+ };
22
+ },
23
+ });
30
24
  },
31
25
  });
@@ -0,0 +1,27 @@
1
+ import "@mail/chatter/web/mail_composer_send_dropdown"; // <- side-effect
2
+ import {registry} from "@web/core/registry";
3
+ import {patch} from "@web/core/utils/patch";
4
+
5
+ const def = registry.category("view_widgets").get("mail_composer_send_dropdown");
6
+ const MailComposerSendDropdownClass = def.component;
7
+
8
+ patch(MailComposerSendDropdownClass.prototype, {
9
+ async onClickSend() {
10
+ const model = this.env.model.config.resModel;
11
+ if (model === "mail.compose.message") {
12
+ return await super.onClickSend(...arguments);
13
+ }
14
+ this.buttonState.disabled = true;
15
+ if (await this.props.record.save()) {
16
+ const method = this.props.record.data.scheduled_date
17
+ ? "action_schedule_message"
18
+ : "action_send_mail";
19
+ this.actionService.doAction(
20
+ await this.orm.call(model, method, [this.props.record.resId], {
21
+ context: this.props.record.context,
22
+ })
23
+ );
24
+ }
25
+ this.buttonState.disabled = false;
26
+ },
27
+ });
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <templates xml:space="preserve">
3
+
4
+ <t t-inherit="mail.MailComposerSendDropdown" t-inherit-mode="extension">
5
+ <xpath expr="//Dropdown" position="attributes">
6
+ <!--Disable the dropdown to send later because the behavior
7
+ needs to be adapted to accept gateway messages. To be removed
8
+ when implemented.
9
+ -->
10
+ <attribute
11
+ name="t-if"
12
+ >env.model.config.resModel === "mail.compose.message"</attribute>
13
+ </xpath>
14
+ </t>
15
+ </templates>
@@ -1,23 +1,25 @@
1
- /* @odoo-module */
2
1
  import {_t} from "@web/core/l10n/translation";
3
2
  import {messageActionsRegistry} from "@mail/core/common/message_actions";
4
3
 
5
- messageActionsRegistry.add("link_gateway_to_thread", {
6
- condition: (component) =>
7
- component.message.gateway_type &&
8
- component.props.thread.model === "discuss.channel",
9
- icon: "fa-link",
10
- title: _t("Link to thread"),
11
- onClick: (component) => component.onClickLinkGatewayToThread(),
12
- sequence: 20,
13
- });
14
-
15
- messageActionsRegistry.add("send_with_gateway", {
16
- condition: (component) =>
17
- !component.message.gateway_type &&
18
- component.props.thread.model !== "discuss.channel",
19
- icon: "fa-share-square-o",
20
- title: _t("Send with gateway"),
21
- onClick: (component) => component.onClickSendWithGateway(),
22
- sequence: 20,
23
- });
4
+ messageActionsRegistry
5
+ .add("link_gateway_to_thread", {
6
+ condition: (component) => {
7
+ return (
8
+ component.props.message.gateway_type &&
9
+ component.props.thread.model === "discuss.channel"
10
+ );
11
+ },
12
+ icon: "fa fa-link",
13
+ title: _t("Link to thread"),
14
+ onClick: (component) => component.onClickLinkGatewayToThread(),
15
+ sequence: 20,
16
+ })
17
+ .add("send_with_gateway", {
18
+ condition: (component) =>
19
+ !component.props.message.gateway_type &&
20
+ component.props.thread.model !== "discuss.channel",
21
+ icon: "fa fa-share-square-o",
22
+ title: _t("Send with gateway"),
23
+ onClick: (component) => component.onClickSendWithGateway(),
24
+ sequence: 20,
25
+ });
@@ -1,20 +1,24 @@
1
- /* @odoo-module */
2
1
  import {Message} from "@mail/core/common/message_model";
3
2
  import {patch} from "@web/core/utils/patch";
4
3
  import {url} from "@web/core/utils/urls";
4
+ import {stateToUrl} from "@web/core/browser/router";
5
5
 
6
- patch(Message, {
6
+ patch(Message.prototype, {
7
+ setup() {
8
+ super.setup(...arguments);
9
+ this.gateway_thread_data = {};
10
+ },
7
11
  get resUrl() {
8
12
  if (!this.gateway_thread_data) {
9
13
  return super.resUrl;
10
14
  }
11
- return `${url("/web")}#model=${this.gateway_thread_data.model}&id=${
12
- this.gateway_thread_data.id
13
- }`;
15
+ return url(
16
+ stateToUrl({
17
+ model: this.gateway_thread_data.model,
18
+ resId: this.gateway_thread_data.id,
19
+ })
20
+ );
14
21
  },
15
- });
16
-
17
- patch(Message.prototype, {
18
22
  get editable() {
19
23
  return super.editable && !this.gateway_type;
20
24
  },
@@ -1,4 +1,3 @@
1
- /* @odoo-module */
2
1
  import {Notification} from "@mail/core/common/notification_model";
3
2
  import {patch} from "@web/core/utils/patch";
4
3
 
@@ -1,8 +1,6 @@
1
- /** @odoo-module */
2
-
3
1
  import {Persona} from "@mail/core/common/persona_model";
4
- import {patch} from "@web/core/utils/patch";
5
2
  import {Record} from "@mail/core/common/record";
3
+ import {patch} from "@web/core/utils/patch";
6
4
 
7
5
  patch(Persona.prototype, {
8
6
  setup() {
@@ -1,14 +1,18 @@
1
- /* @odoo-module */
2
- import {Gateway} from "../../models/gateway.esm";
3
1
  import {Store} from "@mail/core/common/store_service";
4
2
  import {patch} from "@web/core/utils/patch";
5
3
 
6
- /** @type {import("models").Store} */
7
- const storePatch = {
8
- setup() {
9
- super.setup(...arguments);
10
- /** @type {typeof import("@mail_gateway/models/gateway").Gateway} */
11
- this.Gateway = Gateway;
4
+ patch(Store.prototype, {
5
+ async fetchData(thread, ...args) {
6
+ const result = await super.fetchData(thread, ...args);
7
+ thread.gateway_followers = result.gateway_followers;
8
+ return result;
12
9
  },
13
- };
14
- patch(Store.prototype, storePatch);
10
+ async getMessagePostParams(params) {
11
+ const post_params = await super.getMessagePostParams(...arguments);
12
+ if (params.thread.gateway_notifications) {
13
+ post_params.post_data.gateway_notifications =
14
+ params.thread.gateway_notifications;
15
+ }
16
+ return post_params;
17
+ },
18
+ });
@@ -1,8 +1,7 @@
1
- /* @odoo-module */
2
1
  import {assignDefined, assignIn} from "@mail/utils/common/misc";
3
- import {patch} from "@web/core/utils/patch";
4
2
  import {Record} from "@mail/core/common/record";
5
3
  import {Thread} from "@mail/core/common/thread_model";
4
+ import {patch} from "@web/core/utils/patch";
6
5
  import {url} from "@web/core/utils/urls";
7
6
 
8
7
  patch(Thread, {
@@ -25,25 +24,31 @@ patch(Thread.prototype, {
25
24
  this.gateway_followers = Record.many("Persona");
26
25
  },
27
26
  get isChatChannel() {
28
- return this.type === "gateway" || super.isChatChannel;
27
+ return this.channel_type === "gateway" || super.isChatChannel;
29
28
  },
30
29
  get hasMemberList() {
31
- return this.type === "gateway" || super.hasMemberList;
30
+ return this.channel_type === "gateway" || super.hasMemberList;
32
31
  },
33
- get imgUrl() {
34
- if (this.type !== "gateway") {
35
- return super.imgUrl;
32
+ get avatarUrl() {
33
+ if (this.channel_type !== "gateway") {
34
+ return super.avatarUrl;
36
35
  }
37
36
  return url(
38
- `/discuss/channel/${this.id}/avatar_128`,
37
+ `/web/image/discuss.channel/${this.id}/avatar_128`,
39
38
  assignDefined({}, {unique: this.avatarCacheKey})
40
39
  );
41
40
  },
42
41
  /** @param {Object} data */
43
42
  update(data) {
44
43
  super.update(data);
45
- if ("gateway_id" in data && this.type === "gateway") {
44
+ if ("gateway_id" in data && this.channel_type === "gateway") {
46
45
  this.gateway = data.gateway_id;
47
46
  }
48
47
  },
48
+ _computeDiscussAppCategory() {
49
+ if (this.channel_type === "gateway") {
50
+ return this.store.discuss.gateway;
51
+ }
52
+ return super._computeDiscussAppCategory(...arguments);
53
+ },
49
54
  });
@@ -1,8 +1,6 @@
1
- /* @odoo-module */
2
-
3
- import {patch} from "@web/core/utils/patch";
4
- import {DiscussAppCategory} from "@mail/core/common/discuss_app_category_model";
1
+ import {DiscussAppCategory} from "@mail/core/public_web/discuss_app_category_model";
5
2
  import {compareDatetime} from "@mail/utils/common/misc";
3
+ import {patch} from "@web/core/utils/patch";
6
4
 
7
5
  patch(DiscussAppCategory.prototype, {
8
6
  /**
@@ -1,12 +1,16 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <templates>
3
3
  <t
4
- t-name="mail_gateway.DiscussSidebarChannel"
5
- t-inherit="mail.DiscussSidebarChannel"
4
+ t-name="mail_gateway.DiscussSidebarChannel.main"
5
+ t-inherit="mail.DiscussSidebarChannel.main"
6
6
  t-inherit-mode="extension"
7
7
  >
8
8
  <xpath expr="//ThreadIcon" position="attributes">
9
- <attribute name="t-if" add="or thread.type === 'gateway'" separator=" " />
9
+ <attribute
10
+ name="t-if"
11
+ add="or thread.channel_type === 'gateway'"
12
+ separator=" "
13
+ />
10
14
  </xpath>
11
15
  </t>
12
16
  </templates>
@@ -1,39 +1,35 @@
1
- /* @odoo-module */
2
1
  import {reactive} from "@odoo/owl";
3
2
  import {registry} from "@web/core/registry";
3
+ import {user} from "@web/core/user";
4
4
 
5
5
  export class GatewayCoreWeb {
6
6
  constructor(env, services) {
7
7
  Object.assign(this, {
8
8
  busService: services.bus_service,
9
9
  });
10
- /** @type {import("@mail/core/common/messaging_service").Messaging} */
11
- this.messagingService = services["mail.messaging"];
12
10
  /** @type {import("@mail/core/common/store_service").Store} */
13
11
  this.store = services["mail.store"];
14
12
  }
15
13
  setup() {
16
- this.messagingService.isReady.then((data) => {
17
- if (data.current_user_settings?.is_discuss_sidebar_category_gateway_open) {
18
- this.store.discuss.gateway.isOpen = true;
14
+ if (user.settings?.is_discuss_sidebar_category_gateway_open) {
15
+ this.store.discuss.gateway.isOpen = true;
16
+ }
17
+ this.busService.subscribe("res.users.settings", (payload) => {
18
+ if (payload) {
19
+ this.store.discuss.gateway.isOpen =
20
+ payload.is_discuss_sidebar_category_gateway_open ??
21
+ this.store.discuss.gateway.isOpen;
19
22
  }
20
- this.busService.subscribe("res.users.settings", (payload) => {
21
- if (payload) {
22
- this.store.discuss.gateway.isOpen =
23
- payload.is_discuss_sidebar_category_gateway_open ??
24
- this.store.discuss.gateway.isOpen;
25
- }
26
- });
27
23
  });
28
24
  }
29
25
  }
30
26
 
31
27
  export const gatewayCoreWeb = {
32
- dependencies: ["bus_service", "mail.messaging", "mail.store"],
28
+ dependencies: ["bus_service", "mail.store"],
33
29
  start(env, services) {
34
- const gatewayCoreWeb = reactive(new GatewayCoreWeb(env, services));
35
- gatewayCoreWeb.setup();
36
- return gatewayCoreWeb;
30
+ const gateway_core_web = reactive(new GatewayCoreWeb(env, services));
31
+ gateway_core_web.setup();
32
+ return gateway_core_web;
37
33
  },
38
34
  };
39
35
 
@@ -1,4 +1,3 @@
1
- /** @odoo-module **/
2
1
  import {Record} from "@mail/core/common/record";
3
2
 
4
3
  export class Gateway extends Record {
@@ -13,11 +12,11 @@ export class Gateway extends Record {
13
12
  static insert() {
14
13
  return super.insert(...arguments);
15
14
  }
16
- /** @type {number} */
15
+ /** @type {Number} */
17
16
  id;
18
- /** @type {string} */
17
+ /** @type {String} */
19
18
  type;
20
- /** @type {string} */
19
+ /** @type {String} */
21
20
  name;
22
21
  }
23
22
  Gateway.register();
@@ -1,4 +1,3 @@
1
- /* @odoo-module */
2
1
  import {Record} from "@mail/core/common/record";
3
2
 
4
3
  export class GatewayChannel extends Record {
@@ -13,9 +12,9 @@ export class GatewayChannel extends Record {
13
12
  static insert() {
14
13
  return super.insert(...arguments);
15
14
  }
16
- /** @type {number} */
15
+ /** @type {Number} */
17
16
  id;
18
- /** @type {string} */
17
+ /** @type {String} */
19
18
  name;
20
19
  gateway = Record.one("Gateway");
21
20
  }
@@ -1,4 +1,3 @@
1
- /** @odoo-module **/
2
1
  import {Record} from "@mail/core/common/record";
3
2
 
4
3
  export class GatewayFollower extends Record {
@@ -13,9 +12,9 @@ export class GatewayFollower extends Record {
13
12
  static insert() {
14
13
  return super.insert(...arguments);
15
14
  }
16
- /** @type {number} */
15
+ /** @type {Number} */
17
16
  id;
18
- /** @type {string} */
17
+ /** @type {String} */
19
18
  name;
20
19
  partner = Record.one("Persona");
21
20
  channel = Record.one("GatewayChannel");
@@ -0,0 +1 @@
1
+ from . import discuss