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

[15.0][MIG] web_notify: Migration to 15.0 #2381

Merged
merged 42 commits into from
Jan 9, 2023

Conversation

chienandalu
Copy link
Member

Superseeds #2273 adding these improvements:

  • Use ES6 in js files
  • Update screenshots
  • Clean old lint exceptions
  • New icon

cc @Tecnativa TT38350

please review @CarlosRoca13 @pedrobaeza

lmignon and others added 30 commits January 5, 2023 16:40
This technical module allows you to send instant notification messages from the server to the user in live.
Fix a check when comparing a user count with items within a mock call.

The previous method was succeeding by pure luck because OCA test
databases contain 2 users, which happens to be the amount of items
within a mock "call_args" (it contains args + kwargs).
- Use the 'session' class of the JS Framework (session no lounger bound
to web client)
- Test change: compare emitted & received messages based on content, not
order. Using string comparison raises false positives.
Currently translated at 100,0% (5 of 5 strings)

Translation: web-11.0/web-11.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_notify/pt_BR/
Currently translated at 40.0% (2 of 5 strings)

Translation: web-11.0/web-11.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_notify/da/
Only the admin user (sudo) is allowed to send notifications to other
users. The normal users can only send notifications to themselves.

This is to prevent attackers to craft malicious notifications and send
them to other users using RPC.

Correction based on the idea of @hbrunn
Add self-test buttons in demo environment,
Updated readme to show how to test it.
Add buttons to users form
Do not rely on SUPERUSER_ID and avoid getattr usage
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
* [ADD]: all available bootstrap notifications (success/danger/warning/info/default)
* [IMP] use black color for text for default notification.
* [FIX] reverted require string for `bus.Longpolling` and rename `on_message_received` to `on_message` to prevent collisions.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/
It seems besides the custom channels provided in this addon it also catches messages from other channels. E.g. in this case it seems the void popup is triggered by these activity creation bus messages.

**Steps to reproduce**

Odoo commit: could reproduce on 5e8b667951 and 4da82776ff
OCA/web commit: 2465278

* Install crm and web_notify modules
* Create an activity for yourself (tried for admin user)
* Empty popup appears

**Attempt to solve**

It seems the bus handles all messages non exclusively. I've hacked in a conditional to handle only messages from web_notify addon, but its unclear wether this does not break something else.
Currently translated at 100.0% (18 of 18 strings)

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/pt_BR/
Currently translated at 100.0% (18 of 18 strings)

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/zh_CN/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-13.0/web-13.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_notify/
Includes some manual fixes to silent ESLint warnings.
Currently translated at 100.0% (18 of 18 strings)

Translation: web-13.0/web-13.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_notify/de/
@pedrobaeza
Copy link
Member

/ocabot migration web_notify

@OCA-git-bot OCA-git-bot added this to the 15.0 milestone Jan 5, 2023
@OCA-git-bot OCA-git-bot mentioned this pull request Jan 5, 2023
47 tasks
@OCA-git-bot
Copy link
Contributor

The migration issue (#2053) has been updated to reference the current pull request.
however, a previous pull request was referenced : #2273.
Perhaps you should check that there is no duplicate work.
CC : @aiendry-aktivsoftware

@em230418 em230418 mentioned this pull request Jan 6, 2023
Copy link
Contributor

@CarlosRoca13 CarlosRoca13 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 15.0-ocabot-merge-pr-2381-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit b825712 into OCA:15.0 Jan 9, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 3e436be. 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.