diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53161f0a03..44298cbb8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ exclude: | (LICENSE.*|COPYING.*) default_language_version: python: python3 - node: "16.17.0" + node: system repos: - repo: local hooks: diff --git a/README.md b/README.md index 56cf852487..32b47222a4 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ addon | version | maintainers | summary [mail_disable_follower_notification](mail_disable_follower_notification/) | 17.0.1.0.0 | | Don't send emails by default when adding followers to records [mail_forward](mail_forward/) | 17.0.2.0.1 | carlos-lopez-tecnativa | Forward messages from the chatter of any document to other users. [mail_gateway](mail_gateway/) | 17.0.1.0.6 | | Base module for gateway communications -[mail_gateway_whatsapp](mail_gateway_whatsapp/) | 17.0.1.1.1 | | Set a gateway for whatsapp +[mail_gateway_whatsapp](mail_gateway_whatsapp/) | 17.0.1.1.2 | | Set a gateway for whatsapp [mail_history_mark_unread](mail_history_mark_unread/) | 17.0.1.0.0 | | Add 'Mark as Unread' action to messages in History mailbox [mail_layout_force](mail_layout_force/) | 17.0.1.0.1 | ivantodorovich | Force a mail layout on selected email templates [mail_layout_preview](mail_layout_preview/) | 17.0.1.0.0 | | Preview email templates in the browser diff --git a/mail_discuss_channel_unread_sort/README.rst b/mail_discuss_channel_unread_sort/README.rst new file mode 100644 index 0000000000..bc99074299 --- /dev/null +++ b/mail_discuss_channel_unread_sort/README.rst @@ -0,0 +1,93 @@ +================================ +Mail Discuss Channel Unread Sort +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:4ceee16d504b1603b1d386daa1eee6a3805fe04e626ab93e84641a058883ac78 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/17.0/mail_discuss_channel_unread_sort + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_discuss_channel_unread_sort + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module changes the ordering of channels in the Discuss sidebar. + +Unread channels are placed before read channels. Inside the unread +group, channels are ordered by most recent activity so the latest +channel with new messages is shown first. + +Read channels keep the standard alphabetical ordering from Odoo. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Install the module and open Discuss. + +When a channel receives unread messages, it moves to the top of the +Channels section. If several channels are unread, the most recently +updated one is shown first. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* APSL-Nagarro + +Contributors +------------ + +- `APSL Nagarro `__ + + - Miquel Alzanillas + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_discuss_channel_unread_sort/__init__.py b/mail_discuss_channel_unread_sort/__init__.py new file mode 100644 index 0000000000..ef5ae3587f --- /dev/null +++ b/mail_discuss_channel_unread_sort/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/mail_discuss_channel_unread_sort/__manifest__.py b/mail_discuss_channel_unread_sort/__manifest__.py new file mode 100644 index 0000000000..2c26d10bcc --- /dev/null +++ b/mail_discuss_channel_unread_sort/__manifest__.py @@ -0,0 +1,18 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Mail Discuss Channel Unread Sort", + "summary": "Sort discuss channels by most recent unread activity", + "version": "17.0.1.0.0", + "category": "Discuss", + "author": "APSL-Nagarro, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "license": "AGPL-3", + "depends": ["mail"], + "assets": { + "web.assets_backend": [ + "mail_discuss_channel_unread_sort/static/src/js/discuss_app_category_model_patch.esm.js", + ], + }, + "installable": True, +} diff --git a/mail_discuss_channel_unread_sort/pyproject.toml b/mail_discuss_channel_unread_sort/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mail_discuss_channel_unread_sort/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_discuss_channel_unread_sort/readme/CONTRIBUTORS.md b/mail_discuss_channel_unread_sort/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..0875947497 --- /dev/null +++ b/mail_discuss_channel_unread_sort/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [APSL Nagarro](https://nagarro.com) + - Miquel Alzanillas \ No newline at end of file diff --git a/mail_discuss_channel_unread_sort/readme/DESCRIPTION.md b/mail_discuss_channel_unread_sort/readme/DESCRIPTION.md new file mode 100644 index 0000000000..206ae6826d --- /dev/null +++ b/mail_discuss_channel_unread_sort/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +This module changes the ordering of channels in the Discuss sidebar. + +Unread channels are placed before read channels. Inside the unread group, +channels are ordered by most recent activity so the latest channel with new +messages is shown first. + +Read channels keep the standard alphabetical ordering from Odoo. diff --git a/mail_discuss_channel_unread_sort/readme/USAGE.md b/mail_discuss_channel_unread_sort/readme/USAGE.md new file mode 100644 index 0000000000..a36f307188 --- /dev/null +++ b/mail_discuss_channel_unread_sort/readme/USAGE.md @@ -0,0 +1,5 @@ +Install the module and open Discuss. + +When a channel receives unread messages, it moves to the top of the Channels +section. If several channels are unread, the most recently updated one is shown +first. diff --git a/mail_discuss_channel_unread_sort/static/description/icon.png b/mail_discuss_channel_unread_sort/static/description/icon.png new file mode 100644 index 0000000000..e78da4cfd0 Binary files /dev/null and b/mail_discuss_channel_unread_sort/static/description/icon.png differ diff --git a/mail_discuss_channel_unread_sort/static/description/index.html b/mail_discuss_channel_unread_sort/static/description/index.html new file mode 100644 index 0000000000..79b2f0f31f --- /dev/null +++ b/mail_discuss_channel_unread_sort/static/description/index.html @@ -0,0 +1,438 @@ + + + + + +Mail Discuss Channel Unread Sort + + + +
+

Mail Discuss Channel Unread Sort

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module changes the ordering of channels in the Discuss sidebar.

+

Unread channels are placed before read channels. Inside the unread +group, channels are ordered by most recent activity so the latest +channel with new messages is shown first.

+

Read channels keep the standard alphabetical ordering from Odoo.

+

Table of contents

+ +
+

Usage

+

Install the module and open Discuss.

+

When a channel receives unread messages, it moves to the top of the +Channels section. If several channels are unread, the most recently +updated one is shown first.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • APSL-Nagarro
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_discuss_channel_unread_sort/static/src/js/discuss_app_category_model_patch.esm.js b/mail_discuss_channel_unread_sort/static/src/js/discuss_app_category_model_patch.esm.js new file mode 100644 index 0000000000..c1be452336 --- /dev/null +++ b/mail_discuss_channel_unread_sort/static/src/js/discuss_app_category_model_patch.esm.js @@ -0,0 +1,41 @@ +/* @odoo-module */ + +import {DiscussAppCategory} from "@mail/core/common/discuss_app_category_model"; +import {compareDatetime} from "@mail/utils/common/misc"; + +import {patch} from "@web/core/utils/patch"; + +patch(DiscussAppCategory.prototype, { + sortThreads(thread1, thread2) { + if (this.id !== "channels") { + return super.sortThreads(thread1, thread2); + } + + const thread1Unread = thread1.message_unread_counter > 0; + const thread2Unread = thread2.message_unread_counter > 0; + + if (thread1Unread && !thread2Unread) { + return -1; + } + if (thread2Unread && !thread1Unread) { + return 1; + } + if (thread1Unread && thread2Unread) { + const thread1NewestMessage = thread1.newestPersistentNotEmptyOfAllMessage; + const thread2NewestMessage = thread2.newestPersistentNotEmptyOfAllMessage; + return ( + compareDatetime( + thread2.lastInterestDateTime, + thread1.lastInterestDateTime + ) || + compareDatetime( + thread2NewestMessage && thread2NewestMessage.datetime, + thread1NewestMessage && thread1NewestMessage.datetime + ) || + super.sortThreads(thread1, thread2) + ); + } + + return super.sortThreads(thread1, thread2); + }, +}); diff --git a/mail_gateway_whatsapp/README.rst b/mail_gateway_whatsapp/README.rst index 1ad2c3d0d1..1e56ee24de 100644 --- a/mail_gateway_whatsapp/README.rst +++ b/mail_gateway_whatsapp/README.rst @@ -11,7 +11,7 @@ Mail Whatsapp Gateway !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:461c4bb588dcbc2d98136e081b3781fcf72074c29ab4f11c34e345d1defccfcc + !! source digest: sha256:b94369a8a04c0ddeb7f849c9ea615677c902b865318b9d7d2cb87a8064db4172 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/mail_gateway_whatsapp/__manifest__.py b/mail_gateway_whatsapp/__manifest__.py index 65eb697f55..e3cb7de83d 100644 --- a/mail_gateway_whatsapp/__manifest__.py +++ b/mail_gateway_whatsapp/__manifest__.py @@ -5,7 +5,7 @@ "name": "Mail Whatsapp Gateway", "summary": """ Set a gateway for whatsapp""", - "version": "17.0.1.1.1", + "version": "17.0.1.1.2", "license": "AGPL-3", "author": "Creu Blanca, Dixmit, Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", diff --git a/mail_gateway_whatsapp/static/description/index.html b/mail_gateway_whatsapp/static/description/index.html index b1b39771e0..4e64e383ea 100644 --- a/mail_gateway_whatsapp/static/description/index.html +++ b/mail_gateway_whatsapp/static/description/index.html @@ -372,7 +372,7 @@

Mail Whatsapp Gateway

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:461c4bb588dcbc2d98136e081b3781fcf72074c29ab4f11c34e345d1defccfcc +!! source digest: sha256:b94369a8a04c0ddeb7f849c9ea615677c902b865318b9d7d2cb87a8064db4172 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

This module allows to respond whatsapp chats.