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

[16.0][MIG] mail_tracking: Migration to 16.0 #1216

Merged
merged 163 commits into from
Oct 10, 2023

Conversation

payen000
Copy link

@payen000 payen000 commented Sep 5, 2023

Redo of PR #1191; this PR is opened due to inactivity of #1091 (from which the MessagingInitializer._init fix was taken).

@payen000 payen000 force-pushed the 16.0-mail_tracking-mig-payen branch 3 times, most recently from 5942941 to 13154c4 Compare September 5, 2023 21:09
@payen000 payen000 marked this pull request as ready for review September 5, 2023 21:15
@payen000
Copy link
Author

payen000 commented Sep 5, 2023

Hello @luisg123v, could you review this, please?

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some serious issue when trying to test it functionally:

  • Whenever a enter a record I get an error when it tries to load the failed messages tracker:
TypeError: Cannot read properties of undefined (reading 'refreshMessagefailed') at model._onThreadIdOrThreadModelChanged (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:176759:25) (/mail_tracking/static/src/js/models/chatter.esm.js:20) at model._onThreadIdOrThreadModelChanged (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:130691:31) (/mail/static/src/model/model_core.js:371) at Listener.onChange (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133311:52) (/mail/static/src/model/model_manager.js:886) at ModelManager._executeCreatedRecordsOnChange (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133315:26) (/mail/static/src/model/model_manager.js:890) at ModelManager._flushUpdateCycle (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133352:14) (/mail/static/src/model/model_manager.js:927) at ModelManager._notifyListenersInUpdateCycle (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133522:18) (/mail/static/src/model/model_manager.js:1097) at ModelManager._flushUpdateCycle (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133349:14) (/mail/static/src/model/model_manager.js:924) at ModelManager._executeCreatedRecordsComputes (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133269:18) (/mail/static/src/model/model_manager.js:844) at ModelManager._flushUpdateCycle (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:133348:14) (/mail/static/src/model/model_manager.js:923) at ModelManager.insert (http://oca-social-16-0-pr1216-13154c4fcbef.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:132678:14) (/mail/static/src/model/model_manager.js:253)
  • The mail message filter isn't injected into the filter menu:

image

@chienandalu
Copy link
Member

Also, if you took changes from the other PR is good to respect the contributor attribution in a separate commit

@payen000 payen000 force-pushed the 16.0-mail_tracking-mig-payen branch 2 times, most recently from 9f7106f to d1a3359 Compare September 6, 2023 19:47
@payen000 payen000 marked this pull request as draft September 6, 2023 20:31
@payen000 payen000 marked this pull request as ready for review September 6, 2023 20:49
@payen000
Copy link
Author

payen000 commented Sep 6, 2023

Hello @chienandalu, thank you for testing,

the issues you found should now be solved, could you check again, please?

As for this comment:

Also, if you took changes from the other PR is good to respect the contributor attribution in a separate commit

I added a new commit as you suggested, but including Co-authorship and referencing the original PR, please let me know if there is a better/more respectful way of doing this, as I was not able to find a similar case in the guidelines,

thanks again!

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @payen000 :) That can be a way to attribute changes, yes :) (normally I try to cherry-pick and adapt, so I keep the original commit as similar as possible, but is ok)

Functionally I still see some issues:

  • Clicking on the tracking status icon doesn't show up the trackings dialog.
  • The failed messages review doesn't show up in the record thread either

@payen000 payen000 marked this pull request as draft September 7, 2023 20:27
@payen000 payen000 force-pushed the 16.0-mail_tracking-mig-payen branch 9 times, most recently from 33c61ff to caf2c08 Compare September 10, 2023 01:20
@payen000 payen000 marked this pull request as ready for review September 10, 2023 01:41
@payen000 payen000 force-pushed the 16.0-mail_tracking-mig-payen branch 2 times, most recently from 6500e9c to 1d3b076 Compare September 11, 2023 07:00
@payen000
Copy link
Author

Hello again @chienandalu, thank you for the tips, I appreciate it!

I've updated the code, you should be able to see the failed messages and the tracking action now, could you check again, please?

@payen000
Copy link
Author

Hello @chienandalu, I've updated the code so that the MessagingInitializer changes from the first PR are present in their original commit (which also contains a good chunk of the first PR's migration) and added my changes on top as you suggested. Could you check, please?

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like your re-rendering the whole window after each action with the failed messages . Can't you use owl reactivity?

Peek 26-09-2023 09-13

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superb work! I made a succesful functional tour and a final code review

Just two final tweaks 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put yourself in the contributors list 😄 👍


class MailTrackingDiscussController(DiscussController):
@http.route()
def mail_init_messaging(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method has a different signature (https://github.com/odoo/odoo/blob/913c8678cba0741e99610b1174ba6c42ef0c21a6/addons/mail/controllers/discuss.py#L194)

Suggested change
def mail_init_messaging(self):
def mail_init_messaging(self, **kwargs):

@payen000 payen000 force-pushed the 16.0-mail_tracking-mig-payen branch 2 times, most recently from 632dc0c to 504a304 Compare September 27, 2023 16:13
@payen000
Copy link
Author

Hello @chienandalu,

Thank you for reviewing and testing this far, and of course, for your words of encouragement!

I've added your suggested changes, could you check please?

Also, I converted the 'message ids list' inside store into a Set for a faster/more reliable filtering of reviewed messages, since the counter of failed messages on any chatter was being reduced by the total number of stored IDs from all chatters - but not anymore, it is now working as expected.

Thanks again!

@chienandalu
Copy link
Member

Oh, after the last changes:

  • I can't see the failed messages in the discuss app
  • I only see one of the demo failed messages in the record

@payen000 payen000 force-pushed the 16.0-mail_tracking-mig-payen branch from 504a304 to 1205086 Compare October 1, 2023 04:03
@payen000
Copy link
Author

payen000 commented Oct 1, 2023

Sorry @chienandalu, it seems I forgot to reset the runbot after my own tests, that's why most of the records were not visible as failed, after resetting the runbot the failed messages were visible again :)

I've done one last push to re-render the "Retry" and "Set as reviewed" options properly from the Inbox/History/Starred mailboxes, could you check please?

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're ready 😄 👍

Thanks!

@payen000
Copy link
Author

payen000 commented Oct 4, 2023

Thank you @chienandalu!

@payen000
Copy link
Author

payen000 commented Oct 6, 2023

Hello @luisg123v, could you review this, please?

mail_tracking/demo/demo.xml Show resolved Hide resolved
mail_tracking/tests/test_mail_tracking.py Outdated Show resolved Hide resolved
mail_tracking/tests/test_mail_tracking.py Outdated Show resolved Hide resolved
mail_tracking/security/mail_tracking_email_security.xml Outdated Show resolved Hide resolved
mail_tracking/models/mail_tracking_email.py Outdated Show resolved Hide resolved
The following changes were implemented:

1 - Added Failed Message component and related components to reuse the
    Message component when rendering failed messages. This allows us to
    dispose of the messagefailed JS model altogether, since failed messages
    are now just regular messages that were marked as failed.

2 - Added Owl reactivity to failed message actions so that browser does
    not have to be reloaded each time a message is marked as reviewed or
    resent.

3 - Fixed 'Retry' and 'Set as reviewed' flows for failed messages.

4 - Fixed `Failed sent messages` filter on models by overriding `get_view`
    instead of `_fields_view_get`

5 - Refactored folder structure to more closely resemble the `mail`
    module's folder structure.

6 - Refactored module to utilize `Command` as a means to create, write,
    etc. instead of `[0, ...]`, `[4, ...]`.

7 - Fixed and added unit tests.

8 - Removed dead/unused code from `v15`.
@payen000
Copy link
Author

payen000 commented Oct 9, 2023

Hello @luisg123v, I've applied your suggestions, could you check please?

Copy link

@luisg123v luisg123v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-1216-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit b41a54a into OCA:16.0 Oct 10, 2023
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at a324624. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.