Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] mail, * : privatize mail thread methods #29483

Open
wants to merge 12 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@dbeguin
Copy link
Contributor

dbeguin commented Dec 12, 2018

privatize some - still - public methods. Some returns records in sudo.
Some are called by js rpc, some are not.
Should be directly private or hidden behind a public wrapper.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo robodoo added the seen 🙂 label Dec 12, 2018

@C3POdoo C3POdoo added the RD label Dec 12, 2018

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch to c045802 Jan 4, 2019

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch 2 times, most recently from 4e9c9b3 to ac5f2a3 Apr 11, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 12, 2019

[REF] mail, various : privatize message_partner_info_from_emails
Purpose: make some methods private and update naming of some internal
mail methods.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch 2 times, most recently from ada0978 to 3771111 Apr 12, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 12, 2019

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means less requirements on information leak checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 12, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means less requirements on information leak checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from 3771111 to 3432126 Apr 12, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 12, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means less requirements on information leak checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from 3432126 to 991c35c Apr 15, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[IMP] mail: reflect blacklist inheritance on model
Like already done for some mail mixins

  * mail.thread reflected on ir.model: see 1119fdd;
  * mail.activity.mixin reflected on ir.model: see f480218;

We allow to reflect the mail.blacklist.mixin on ir.model in this commit. This
inheritance imply the mail.address.mixin to allow normalization of emails on
models using the blacklist mixin.

It is useful notably to clearly store this inheritance and also allow
future tweaking through studio to enable more advanced mail capabilities
to custom models. Blacklist is useful when dealing with mass mailing and
marketing automation.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means less requirements on information leak checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from 991c35c to c1397db Apr 15, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[IMP] mail: reflect blacklist inheritance on model
Like already done for some mail mixins

  * mail.thread reflected on ir.model: see 1119fdd;
  * mail.activity.mixin reflected on ir.model: see f480218;

We allow to reflect the mail.blacklist.mixin on ir.model in this commit. This
inheritance imply the mail.address.mixin to allow normalization of emails on
models using the blacklist mixin.

It is useful notably to clearly store this inheritance and also allow
future tweaking through studio to enable more advanced mail capabilities
to custom models. Blacklist is useful when dealing with mass mailing and
marketing automation.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin. Finally all sudo hidden in the computation is
removed. Caller now give a sudo-ed record set in order to be more explicit.
Low level method just computes the result and does not care about sudo-ing
or ACLs.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_receive_bounce from mail thread pr…
…ivate

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_receive_bounce as private as it is not intended
to be used externally. Future commit(s) will probably rewrite part of the
bounce logic. This commit is just a privatization before some other pending changes.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from c1397db to 3e6ddb0 Apr 15, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[IMP] mail: reflect blacklist inheritance on model
Like already done for some mail mixins

  * mail.thread reflected on ir.model: see 1119fdd;
  * mail.activity.mixin reflected on ir.model: see f480218;

We allow to reflect the mail.blacklist.mixin on ir.model in this commit. This
inheritance imply the mail.address.mixin to allow normalization of emails on
models using the blacklist mixin.

It is useful notably to clearly store this inheritance and also allow
future tweaking through studio to enable more advanced mail capabilities
to custom models. Blacklist is useful when dealing with mass mailing and
marketing automation.

It will also be used in mailgateway to find all blacklist-related models
in Odoo and update the blacklist accordingly to the bounce and error
management in the mailgateway. Those improvements will come soon.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin. Finally all sudo hidden in the computation is
removed. Caller now give a sudo-ed record set in order to be more explicit.
Low level method just computes the result and does not care about sudo-ing
or ACLs.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_receive_bounce from mail thread pr…
…ivate

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_receive_bounce as private as it is not intended
to be used externally. Future commit(s) will probably rewrite part of the
bounce logic. This commit is just a privatization before some other pending changes.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch 2 times, most recently from cbf59d2 to e4020fc Apr 15, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin. Finally all sudo hidden in the computation is
removed. Caller now give a sudo-ed record set in order to be more explicit.
Low level method just computes the result and does not care about sudo-ing
or ACLs.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 15, 2019

[REF] mail, various : make message_receive_bounce from mail thread pr…
…ivate

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_receive_bounce as private as it is not intended
to be used externally. Future commit(s) will probably rewrite part of the
bounce logic. This commit is just a privatization before some other pending changes.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 17, 2019

[REF] mail: perform light code cleaning in mail gateway
  * remove use of email_references regex. Indeed emails are routed using their
    messageId and not the regex anymore since several versions;
  * clean some unnecessary variables;
  * update message_parse to add data in parsed dict and avoid re-parsing stuff;

Also remove some unnecessary check, like

  * we always have a message ID after parsing;
  * simplify variable type input;

    * message_parse accepts only valid email.message instances and to avoid
      several decode / encode. Tests are updated accordingly when calling
      directly this method;

  * filter parsed values before calling message_post;

Related to task ID 1911679
Linked to PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from ea59bdd to 5ef7deb Apr 18, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin. Finally all sudo hidden in the computation is
removed. Caller now give a sudo-ed record set in order to be more explicit.
Low level method just computes the result and does not care about sudo-ing
or ACLs.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail, various : make message_receive_bounce from mail thread pr…
…ivate

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_receive_bounce as private as it is not intended
to be used externally. Future commit(s) will probably rewrite part of the
bounce logic. This commit is just a privatization before some other pending changes.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[FIX] mail: fix unfollow through followers widget
Purpose: fix crash when removing someone from followers through UI.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[IMP] mail: reflect blacklist inheritance on model
Like already done for some mail mixins

  * mail.thread reflected on ir.model: see 1119fdd;
  * mail.activity.mixin reflected on ir.model: see f480218;

We allow to reflect the mail.blacklist.mixin on ir.model in this commit. This
inheritance imply the mail.address.mixin to allow normalization of emails on
models using the blacklist mixin.

It is useful notably to clearly store this inheritance and also allow
future tweaking through studio to enable more advanced mail capabilities
to custom models. Blacklist is useful when dealing with mass mailing and
marketing automation.

It will also be used in mailgateway to find all blacklist-related models
in Odoo and update the blacklist accordingly to the bounce and error
management in the mailgateway. Those improvements will come soon.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[IMP] test_mail: add some mail gateway tests
Purpose: add some tests related to bounce management.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail: perform some code cleaning in mail gateway
Routing

  * remove use of email_references regex. Indeed emails are routed using their
    messageId and not the regex anymore since several versions;
  * clean some unnecessary variables;

  * clean api of route process verify

Also remove some unnecessary check, like

  * we always have a message ID after parsing;
  * simplify variable type input;

    * message_parse accepts only valid email.message instances and to avoid
      several decode / encode. Tests are updated accordingly when calling
      directly this method;

  *

Parsing email values

  * update message_parse to add some more data directly in parsed dictionary
    and avoid having to parse value again. For example recipients computation
    is now done directly in parsing, including email check and reconstruction
    using tools methods. That way routing just has to handle those values
    and not compute part of them;
  * filter parsed values before calling message_post to ensure right values
    are given to it instead of having to manage them in message_post. Indeed
    caller has to give the right input;
  * make parsing sub-methods (extract payload, post process payload) have
    a dictionary as input and output to always manage a dictionary of values
    through the parsing methods;

Related to task ID 1911679
Linked to PR odoo#29483

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from 8b53b3d to 5a7f38a Apr 18, 2019

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[FIX] mail: fix unfollow through followers widget
Purpose: fix crash when removing someone from followers through UI.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin. Finally all sudo hidden in the computation is
removed. Caller now give a sudo-ed record set in order to be more explicit.
Low level method just computes the result and does not care about sudo-ing
or ACLs.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail, various : make message_receive_bounce from mail thread pr…
…ivate

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_receive_bounce as private as it is not intended
to be used externally. Future commit(s) will probably rewrite part of the
bounce logic. This commit is just a privatization before some other pending changes.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[IMP] mail: reflect blacklist inheritance on model
Like already done for some mail mixins

  * mail.thread reflected on ir.model: see 1119fdd;
  * mail.activity.mixin reflected on ir.model: see f480218;

We allow to reflect the mail.blacklist.mixin on ir.model in this commit. This
inheritance imply the mail.address.mixin to allow normalization of emails on
models using the blacklist mixin.

It is useful notably to clearly store this inheritance and also allow
future tweaking through studio to enable more advanced mail capabilities
to custom models. Blacklist is useful when dealing with mass mailing and
marketing automation.

It will also be used in mailgateway to find all blacklist-related models
in Odoo and update the blacklist accordingly to the bounce and error
management in the mailgateway. Those improvements will come soon.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[IMP] test_mail: add tests for bounce management in mail gateway
Note that some asserts are commented as crashing in current master. Indeed
behavior will be improved in future commits.

Also perform some light cleaning in mail gateway tests. And add a tag so
that we can test the mail gateway independently from other mail-related
tests.

Related to task ID 1911679
Linked to PR odoo#29483

tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2019

[REF] mail: perform some code cleaning in mail gateway
Routing

  * remove use of email_references regex. Indeed emails are routed using their
    messageId and not the regex anymore since several versions;
  * clean some unnecessary variables;

  * clean api of route process verify

Also remove some unnecessary check, like

  * we always have a message ID after parsing;
  * simplify variable type input;

    * message_parse accepts only valid email.message instances and to avoid
      several decode / encode. Tests are updated accordingly when calling
      directly this method;

  *

Parsing email values

  * update message_parse to add some more data directly in parsed dictionary
    and avoid having to parse value again. For example recipients computation
    is now done directly in parsing, including email check and reconstruction
    using tools methods. That way routing just has to handle those values
    and not compute part of them;
  * filter parsed values before calling message_post to ensure right values
    are given to it instead of having to manage them in message_post. Indeed
    caller has to give the right input;
  * make parsing sub-methods (extract payload, post process payload) have
    a dictionary as input and output to always manage a dictionary of values
    through the parsing methods;

Related to task ID 1911679
Linked to PR odoo#29483

dbeguin and others added some commits Dec 12, 2018

[REF] mail, various : make message_partner_info_from_emails from mail…
… thread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_partner_info_from_emails as private as it is
not intended to be used externally. Instead we define a controller used
in chatter that grants access to this method.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR #29483
[REF] mail, various : make message_get_default_recipients from mail t…
…hread private

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_get_default_recipients as private as it is
not intended to be used externally. Its signature is improved to clearly
separate model-inherited method (overriden in some addons) and general tool
method given by the mixin. Finally all sudo hidden in the computation is
removed. Caller now give a sudo-ed record set in order to be more explicit.
Low level method just computes the result and does not care about sudo-ing
or ACLs.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR #29483
[REF] mail, various : make message_receive_bounce from mail thread pr…
…ivate

Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Less publicly available mixin methods from mail.thread
means more control on information and access checks.

In this commit we put message_receive_bounce as private as it is not intended
to be used externally. Future commit(s) will probably rewrite part of the
bounce logic. This commit is just a privatization before some other pending changes.

Some addons are updated accordingly to the method change.

Related to task ID 1911679
Linked to PR #29483
[IMP] mail: reflect blacklist inheritance on model
Like already done for some mail mixins

  * mail.thread reflected on ir.model: see 1119fdd;
  * mail.activity.mixin reflected on ir.model: see f480218;

We allow to reflect the mail.blacklist.mixin on ir.model in this commit. This
inheritance imply the mail.address.mixin to allow normalization of emails on
models using the blacklist mixin.

It is useful notably to clearly store this inheritance and also allow
future tweaking through studio to enable more advanced mail capabilities
to custom models. Blacklist is useful when dealing with mass mailing and
marketing automation.

It will also be used in mailgateway to find all blacklist-related models
in Odoo and update the blacklist accordingly to the bounce and error
management in the mailgateway. Those improvements will come soon.

Related to task ID 1911679
Linked to PR #29483
[FIX] mail: fix unfollow through followers widget
Purpose: fix crash when removing someone from followers through UI.

Related to task ID 1911679
Linked to PR #29483
[IMP] test_mail: add tests for bounce management in mail gateway and …
…clean them

This commit add some tests for bounce management in mail gateway to enforce
some bounce detection that are not tested currently. Some test asserts about
bounce / blacklist management are commented as they are not completely
working currently. This will be improved soon in master.

Some cleaning in also done in all mail gateway tests. Notably some call to
tool methods are cleaned / simplified, duplicate tests are removed.

Related to task ID 1911679
Linked to PR #29483
[IMP] mail, crm, mass_mailing : reset bounce on mail reception
The number of message bouce is incremented each time the email bounce
on a specific email address. To have a correct information, we should
reset to zero this counter if we receive a mail from this address.
Indeed, if we receive an email from an email address, this email is
active and the message bounce number (if > 0) is not relevant anymore.

Also, add a check in autoblacklist rule. No need to check the stats
if message_bounce is < 5.

Task ID : 1893155
This taks is also related with Task ID : 33224,
especially the autoblacklist rule part.

Closes PR #27885
[REF] mail: improve bounce management in mail gateway
Purpose
  * better management of bounce, notably when detecting a bounce not linked
    to the bounce alias configuration;
  * better integration with blacklist mechanism;

Specifications
  * when detecting a bounce, correctly call the bounce management method on
    all models inheriting from blacklist;
  * correctly update bounce counter;
  * UPDATE ME
[REF] mail: perform some code cleaning in mail gateway
Routing

  * remove use of email_references regex. Indeed emails are routed using their
    messageId and not the regex anymore since several versions;
  * clean some unnecessary variables;

  * clean api of route process verify

Also remove some unnecessary check, like

  * we always have a message ID after parsing;
  * simplify variable type input;

    * message_parse accepts only valid email.message instances and to avoid
      several decode / encode. Tests are updated accordingly when calling
      directly this method;

  *

Parsing email values

  * update message_parse to add some more data directly in parsed dictionary
    and avoid having to parse value again. For example recipients computation
    is now done directly in parsing, including email check and reconstruction
    using tools methods. That way routing just has to handle those values
    and not compute part of them;
  * filter parsed values before calling message_post to ensure right values
    are given to it instead of having to manage them in message_post. Indeed
    caller has to give the right input;
  * make parsing sub-methods (extract payload, post process payload) have
    a dictionary as input and output to always manage a dictionary of values
    through the parsing methods;

Related to task ID 1911679
Linked to PR #29483
[REF] mail: make blacklist a mixin built upon mail.thread and add mes…
…sage_bounce

  * mail.blacklist.mixin now clearly make inheritance on mail.thread. Indeed
    we consider record using the blacklist mechanism a being used in mailing
    features, meaning they will anyway inherit form mail.thread. In standard
    Odoo it is the case for the 3 models using it (Lead, Contact and Mailing
    Contact);
  * define message_bounce directly in mail.blacklist.mixin. Bounce counter
    is anyway linked to the blacklist and mailing mechanism;

Inherit declaration is updated to avoid MRO issues and clearly put leaf
classes in front.

@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-mail-privatize-mail-thread-methods-dbe branch from 5a7f38a to 44f39db Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.